code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if(!ORYX.Plugins) ORYX.Plugins = new Object(); ORYX.Plugins.Changelog = { construct: function construct() { arguments.callee.$.construct.apply(this, arguments); this.changelogDiv = document.createElement('div'); this.isEmpty = true; var emptyDiv = Element.extend(document.createElement('div')); emptyDiv.update("No changes so far."); emptyDiv.className = "empty"; this.changelogDiv.appendChild(emptyDiv); this.undologDiv = document.createElement('div'); this.undologDiv.className = "undolog"; this.changelogDiv.appendChild(this.undologDiv); this.redologDiv = document.createElement('div'); this.redologDiv.className = "redolog"; this.changelogDiv.appendChild(this.redologDiv); this.undolog = {}; this.redolog = {}; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_ADDED_TO_UNDO_STACK, this.addCommandToUndolog.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_UNDO_STACK, this.moveCommandToRedolog.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_REDO_STACK, this.moveCommandToUndolog.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK, this.removeCommandFromUndolog.bind(this)); // syncro reverted a command this.facade.registerOnEvent(ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS, this.updateFarbrauschInfos.bind(this)); }, onLoaded: function onLoaded(event) { this.createChangelogTab(); }, createChangelogTab: function createChangelogTab() { this.facade.raiseEvent({ 'tabid': 'pwave-changelog', 'type': ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB, 'forceExecution': true, 'tabTitle': 'Changelog', 'tabOrder': 1, 'tabDivEl': this.changelogDiv, 'displayHandler': this.refreshChangelog.bind(this) }); }, addCommandToUndolog: function addCommandToUndolog(event) { var command = event.commands[0]; var entry = this.createCommandDiv(command); if (this.isEmpty) { this.isEmpty = false; this.changelogDiv.removeChild(this.changelogDiv.firstChild); } this.undologDiv.appendChild(entry); this.undolog[command.getCommandId()] = entry; this.refreshChangelog(); this.clearRedolog(); }, moveCommandToRedolog: function moveCommandToRedolog(event) { var command = event.commands[0]; var commandDiv = this.undolog[command.getCommandId()]; if (typeof commandDiv === 'undefined') { ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in undolog."); return; } this.undologDiv.removeChild(commandDiv); delete this.undolog[command.getCommandId()]; this.redologDiv.insertBefore(commandDiv, this.redologDiv.firstChild); this.redolog[command.getCommandId()] = commandDiv; }, moveCommandToUndolog: function moveCommandToUndolog(event) { var command = event.commands[0]; var commandDiv = this.redolog[command.getCommandId()]; if (typeof commandDiv === 'undefined') { ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in redolog."); return; } this.redologDiv.removeChild(commandDiv); delete this.redolog[command.getCommandId()]; this.undologDiv.appendChild(commandDiv); this.undolog[command.getCommandId()] = commandDiv; }, removeCommandFromUndolog: function removeCommandFromUndolog(event) { var command = event.commands[0]; var commandDiv = this.undolog[command.getCommandId()]; if (typeof commandDiv === 'undefined') { ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in undolog."); return; } this.undologDiv.removeChild(commandDiv); delete this.undolog[command.getCommandId()]; }, clearRedolog: function clearRedolog() { while (this.redologDiv.firstChild) { this.redologDiv.removeChild(this.redologDiv.firstChild); } this.redolog = {}; }, createCommandDiv: function createCommandDiv(command) { var userId = command.getCreatorId(); var entry = Element.extend(document.createElement('div')); entry.className = "entry"; var colorDiv = Element.extend(document.createElement('div')); colorDiv.className = "userColor"; colorDiv.style.backgroundColor = this.getColorForUserId(userId); entry.appendChild(colorDiv); var commandNameDiv = Element.extend(document.createElement('div')); commandNameDiv.className = "commandName"; commandNameDiv.update(command.getDisplayName()); entry.appendChild(commandNameDiv); var date = this.getDateString(command.getCreatedAt()) var dateDiv = Element.extend(document.createElement('div')); dateDiv.className = "date"; dateDiv.update(date.date); entry.appendChild(dateDiv); var usernameDiv = Element.extend(document.createElement('div')); usernameDiv.className = "username"; usernameDiv.update("by " + this.getDisplayNameForUserId(userId)); entry.appendChild(usernameDiv); var timeDiv = Element.extend(document.createElement('div')); timeDiv.className = "time"; timeDiv.update(date.time); entry.appendChild(timeDiv); entry.onclick = this.getOnClickFunction(command.getCommandId()).bind(this); return entry; }, getDateString: function getDateString(timestamp) { var date = new Date(timestamp); var day = String(date.getDate()); if (day.length === 1) { day = "0" + day; } var month = String(date.getMonth() + 1); if (month.length === 1) { month = "0" + month; } var year = String(date.getFullYear()); var hour = String(date.getHours()); if (hour.length === 1) { hour = "0" + hour; } var minute = String(date.getMinutes()); if (minute.length === 1) { minute = "0" + minute; } return {'date': day + "." + month + "." + year, 'time': hour + ":" + minute}; }, getOnClickFunction: function getOnClickFunction(commandId){ return function onClick() { if (typeof this.undolog[commandId] !== "undefined") { var toUndo = this.getFollowingCommands(ORYX.Stacks.undo, commandId); toUndo.pop(); var commands = toUndo.map(function (command) { return new ORYX.Core.Commands["WaveGlobalUndo.undoCommand"](command, this.facade); }.bind(this)); } else if (typeof this.redolog[commandId] !== "undefined") { var toRedo = this.getFollowingCommands(ORYX.Stacks.redo, commandId); var commands = toRedo.map(function (command) { return new ORYX.Core.Commands["WaveGlobalUndo.redoCommand"](command, this.facade); }.bind(this)); } else { throw "Changelog: Command not found on undo or redo stack"; } if (commands.length > 0) { this.facade.executeCommands(commands); } } }, getFollowingCommands: function(stack, commandId) { for (var i = 0; i < stack.length; i++) { var cmd = stack[i][0]; if (cmd.getCommandId() === commandId && i < stack.length) { return stack.slice(i).reverse(); } } return []; }, updateFarbrauschInfos: function updateFarbrauschInfos(evt) { this.users = evt.users; }, getColorForUserId: function getColorForUserId(userId) { var user = this.users[userId]; if(typeof user === 'undefined' || typeof user.color === 'undefined') { return "#000000"; //DefaultColor } return user.color; }, getDisplayNameForUserId: function getDisplayNameForUserId(userId) { var user = this.users[userId]; if(typeof user === 'undefined' || typeof user.displayName === 'undefined') { return "Anonymous"; } return user.displayName; }, refreshChangelog: function refreshChangelog() { try { this.changelogDiv.parentNode.scrollTop = this.changelogDiv.parentNode.scrollHeight; } catch(e) { // changelog has not yet been redered } } }; ORYX.Plugins.Changelog = ORYX.Plugins.AbstractPlugin.extend(ORYX.Plugins.Changelog);
08to09-processwave
oryx/editor/client/scripts/Plugins/changelog.js
JavaScript
mit
10,554
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * @namespace Oryx name space for plugins * @name ORYX.Plugins */ if(!ORYX.Plugins) ORYX.Plugins = new Object(); /** * The view plugin offers all of zooming functionality accessible over the * tool bar. This are zoom in, zoom out, zoom to standard, zoom fit to model. * * @class ORYX.Plugins.View * @extends Clazz * @param {Object} facade The editor facade for plugins. */ ORYX.Plugins.View = { /** @lends ORYX.Plugins.View.prototype */ facade: undefined, construct: function(facade, ownPluginData) { this.facade = facade; //Standard Values this.zoomLevel = 1.0; this.maxFitToScreenLevel=1.5; this.minZoomLevel = 0.1; this.maxZoomLevel = 2.5; this.diff=5; //difference between canvas and view port, s.th. like toolbar?? //Read properties ownPluginData.properties.each( function(property) { if (property.zoomLevel) {this.zoomLevel = Number(1.0);} if (property.maxFitToScreenLevel) {this.maxFitToScreenLevel=Number(property.maxFitToScreenLevel);} if (property.minZoomLevel) {this.minZoomLevel = Number(property.minZoomLevel);} if (property.maxZoomLevel) {this.maxZoomLevel = Number(property.maxZoomLevel);} }.bind(this)); /* Register zoom in */ this.facade.offer({ 'name':ORYX.I18N.View.zoomIn, 'functionality': this.zoom.bind(this, [1.0 + ORYX.CONFIG.ZOOM_OFFSET]), 'group': ORYX.I18N.View.group, 'iconCls': 'pw-toolbar-button pw-toolbar-zoom-in', 'description': ORYX.I18N.View.zoomInDesc, 'index': 1, 'minShape': 0, 'maxShape': 0, 'isEnabled': function(){return this.zoomLevel < this.maxZoomLevel }.bind(this), 'visibleInViewMode': true }); /* Register zoom out */ this.facade.offer({ 'name':ORYX.I18N.View.zoomOut, 'functionality': this.zoom.bind(this, [1.0 - ORYX.CONFIG.ZOOM_OFFSET]), 'group': ORYX.I18N.View.group, 'iconCls': 'pw-toolbar-button pw-toolbar-zoom-out', 'description': ORYX.I18N.View.zoomOutDesc, 'index': 2, 'minShape': 0, 'maxShape': 0, 'isEnabled': function(){ return this._checkSize() }.bind(this), 'visibleInViewMode': true }); /* Register zoom standard */ this.facade.offer({ 'name':ORYX.I18N.View.zoomStandard, 'functionality': this.setAFixZoomLevel.bind(this, 1), 'group': ORYX.I18N.View.group, 'iconCls': 'pw-toolbar-button pw-toolbar-actual-size', 'description': ORYX.I18N.View.zoomStandardDesc, 'index': 3, 'minShape': 0, 'maxShape': 0, 'isEnabled': function(){return this.zoomLevel != 1}.bind(this), 'visibleInViewMode': true }); /* Register zoom fit to model */ this.facade.offer({ 'name':ORYX.I18N.View.zoomFitToModel, 'functionality': this.zoomFitToModel.bind(this, true, true), 'group': ORYX.I18N.View.group, 'iconCls': 'pw-toolbar-button pw-toolbar-fit-screen', 'description': ORYX.I18N.View.zoomFitToModelDesc, 'index': 4, 'minShape': 0, 'maxShape': 0, 'visibleInViewMode': true }); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ORYX_SHOWN, this.onOryxShown.bind(this)); }, onOryxShown: function onOryxShown() { this.zoomFitToModel(false, true) }, /** * It calculates the zoom level to fit whole model into the visible area * of the canvas. Than the model gets zoomed and the position of the * scroll bars are adjusted. * */ zoomFitToModel: function handleFitToModel(zoomIn, zoomOut) { var newZoomLevel = this.calculateZoomLevelForFitToModel(); if (zoomIn && newZoomLevel > this.zoomLevel) { this.setAFixZoomLevel(newZoomLevel); } else if (zoomOut && newZoomLevel < this.zoomLevel) { this.setAFixZoomLevel(newZoomLevel); } this.centerModel(); }, centerModel: function centerModel() { var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode; var visibleHeight = scrollNode.getHeight() - 30; var visibleWidth = scrollNode.getWidth() - 30; var nodes = this.facade.getCanvas().getChildShapes(); if(!nodes || nodes.length < 1) { return; } /* Calculate size of canvas to fit the model */ var bounds = nodes[0].absoluteBounds().clone(); nodes.each(function(node) { bounds.include(node.absoluteBounds().clone()); }); var scrollPosY = ((bounds.center()).y * this.zoomLevel) - (0.5 * visibleHeight); scrollNode.scrollTop = Math.round(scrollPosY); var scrollPosX = ((bounds.center()).x * this.zoomLevel)- (0.5 * visibleWidth); scrollNode.scrollLeft = Math.round(scrollPosX); }, /** * It sets the zoom level to a fix value and call the zooming function. * * @param {Number} zoomLevel * the zoom level */ setAFixZoomLevel : function(zoomLevel) { this.zoomLevel = zoomLevel; this._checkZoomLevelRange(); this.zoom(1); }, /** * It does the actual zooming. It changes the viewable size of the canvas * and all to its child elements. * * @param {Number} factor * the factor to adjust the zoom level */ zoom: function(factor) { // TODO: Zoomen auf allen Objekten im SVG-DOM this.zoomLevel *= factor; var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode; var canvas = this.facade.getCanvas(); var newWidth = canvas.bounds.width() * this.zoomLevel; var newHeight = canvas.bounds.height() * this.zoomLevel; /* Set new top offset */ var offsetTop = (canvas.node.parentNode.parentNode.parentNode.offsetHeight - newHeight) / 2.0; offsetTop = offsetTop > 20 ? offsetTop - 20 : 0; canvas.node.parentNode.parentNode.style.marginTop = offsetTop + "px"; offsetTop += 5; canvas.getHTMLContainer().style.top = offsetTop + "px"; /*readjust scrollbar*/ var newScrollTop= scrollNode.scrollTop - Math.round((canvas.getHTMLContainer().parentNode.getHeight()-newHeight) / 2)+this.diff; var newScrollLeft= scrollNode.scrollLeft - Math.round((canvas.getHTMLContainer().parentNode.getWidth()-newWidth) / 2)+this.diff; /* Set new Zoom-Level */ canvas.setSize({width: newWidth, height: newHeight}, true); /* Set Scale-Factor */ canvas.node.setAttributeNS(null, "transform", "scale(" +this.zoomLevel+ ")"); /* Refresh the Selection */ this.facade.updateSelection(true); // scrollNode.scrollTop=newScrollTop; // scrollNode.scrollLeft=newScrollLeft; /* Update the zoom-level*/ canvas.zoomLevel = this.zoomLevel; this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_CANVAS_ZOOMED, zoomLevel: this.zoomLevel }); }, calculateZoomLevelForFitToModel: function calculateZoomLevelForFitToModel() { /* Get the size of the visible area of the canvas */ var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode; var visibleHeight = scrollNode.getHeight() - 30; var visibleWidth = scrollNode.getWidth() - 30; var nodes = this.facade.getCanvas().getChildShapes(); if(!nodes || nodes.length < 1) { return this.zoomLevel; } /* Calculate size of canvas to fit the model */ var bounds = nodes[0].absoluteBounds().clone(); nodes.each(function(node) { bounds.include(node.absoluteBounds().clone()); }); /* Set new Zoom Level */ var scaleFactorWidth = visibleWidth / bounds.width(); var scaleFactorHeight = visibleHeight / bounds.height(); /* Choose the smaller zoom level to fit the whole model */ var zoomFactor = scaleFactorHeight < scaleFactorWidth ? scaleFactorHeight : scaleFactorWidth; /*Test if maximum zoom is reached*/ if(zoomFactor>this.maxFitToScreenLevel){zoomFactor=this.maxFitToScreenLevel} return zoomFactor; }, /** * It checks if the zoom level is less or equal to the level, which is required * to schow the whole canvas. * * @private */ _checkSize:function(){ var canvasParent=this.facade.getCanvas().getHTMLContainer().parentNode; var minForCanvas= Math.min((canvasParent.parentNode.getWidth()/canvasParent.getWidth()),(canvasParent.parentNode.getHeight()/canvasParent.getHeight())); // In some browsers, element.getWidth() will return 0 if the element is not yet displayed. // In this case, minForCanvas will be NaN because we divide by zero. // We return true if this happens because it only happens at the start of Oryx when zooming out should be allowed. return isNaN(minForCanvas) || 1.3 > minForCanvas; }, /** * It checks if the zoom level is included in the definined zoom * level range. * * @private */ _checkZoomLevelRange: function() { /*var canvasParent=this.facade.getCanvas().getHTMLContainer().parentNode; var maxForCanvas= Math.max((canvasParent.parentNode.getWidth()/canvasParent.getWidth()),(canvasParent.parentNode.getHeight()/canvasParent.getHeight())); if(this.zoomLevel > maxForCanvas) { this.zoomLevel = maxForCanvas; }*/ if(this.zoomLevel < this.minZoomLevel) { this.zoomLevel = this.minZoomLevel; } if(this.zoomLevel > this.maxZoomLevel) { this.zoomLevel = this.maxZoomLevel; } } }; ORYX.Plugins.View = Clazz.extend(ORYX.Plugins.View);
08to09-processwave
oryx/editor/client/scripts/Plugins/view.js
JavaScript
mit
10,928
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if (!ORYX.Plugins) ORYX.Plugins = new Object(); /** * This plugin implements the syncro algorithm for concurrent editing **/ ORYX.Plugins.Syncro = Clazz.extend({ facade: undefined, LAMPORT_OFFSET : 3, lamportClock : 1, localState : {}, initialized : false, // Lib (locaState, etc.) has not been initialized yet. construct: function construct(facade) { this.facade = facade; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_NEW_POST_MESSAGE_RECEIVED, this.handleNewPostMessageReceived.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE, this.handleNewCommandForRemoteState.bind(this)); }, /** Direction: Wave -> Oryx (New remote commands in Wave State) **/ handleNewPostMessageReceived: function handleNewPostMessageReceived(event) { var data = event.data; if (data.target !== "syncro") { return; } var commandsArray = data.message; this.handleRemoteCommands(commandsArray); }, handleRemoteCommands: function handleRemoteCommands(remoteCommands) { // new commands appeared in wave state -> run syncro algorithm var remoteCommand; var newCommand; var localCommand; var localCommands; var newCommands = []; var revertCommands; var applyCommands; // fetch new commands obtained from other users, merge into local state for (var i = 0; i < remoteCommands.length; i++) { remoteCommand = remoteCommands[i]; if (typeof this.localState[remoteCommand.id] === "undefined") { this.localState[remoteCommand.id] = remoteCommand; newCommands.push(remoteCommand); } } // bring new and local commands into chronological order newCommands.sort(this.compareCommands); localCommands = this.getValuesFromDict(this.localState); localCommands.sort(this.compareCommands); // set lamportClock accordingly this.lamportClock = this.getClockValueFromSortedCommands(localCommands); if (!this.initialized) { // When snycro is not initialized, all comands are new, no need to run algorithm this.initialized = true; this.sendCommandsToOryx(null, [], newCommands); this.facade.raiseEvent({'type': ORYX.CONFIG.EVENT_SYNCRO_INITIALIZATION_DONE}); return; } // For each new command find all subsequent applied commands and mark them as to be // reverted. Pass them and the new command to Oryx for execution. localCommands.reverse(); for (var n = 0; n < newCommands.length; n++) { newCommand = newCommands[n]; revertCommands = []; applyCommands = []; for (var j = 0; j < localCommands.length; j++) { localCommand = localCommands[j]; if (localCommand === newCommand) { applyCommands.push(localCommand); applyCommands.reverse(); // pass everythin to Oryx for execution this.sendCommandsToOryx(newCommand, revertCommands, applyCommands); break; } else if (!this.inArray(localCommand, newCommands)) { // only commands that have already been applied and therefore are not // part of the new commands need to be reverted applyCommands.push(localCommand); revertCommands.push(localCommand); } } } }, sendCommandsToOryx: function sendCommandsToOryx(newCommand, revertCommands, applyCommands) { this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS, 'newCommand': newCommand, 'revertCommands': revertCommands, 'applyCommands': applyCommands, 'forceExecution': true }); }, /** Direction: Oryx -> Wave (New local command needs to be pushed into Wave State) **/ handleNewCommandForRemoteState: function handleNewCommandForRemoteState(event) { this.pushCommands(event.commands); }, pushCommands: function pushCommands(commands) { // new commands executed on the local client are pushed into wave state var commandId = this.getNextCommandId(); var delta = { 'commands': commands, 'userId': this.facade.getUserId(), 'id': commandId, 'clock': this.lamportClock }; // push into local state this.localState[commandId] = delta; // push into wave state this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_POST_MESSAGE, 'target': 'syncroWave', 'action': 'save', 'message': delta }); // adjust Lamport clock for new command this.lamportClock += this.LAMPORT_OFFSET; }, /** helper functions **/ compareCommands: function compareCommands(command1, command2) { // compare-function to sort commands chronologically var delta = command1.clock - command2.clock; if (delta === 0) { if (command1.userId < command2.userId) { return -1; } else { return 1; } } return delta; }, getClockValueFromSortedCommands: function getClockValueFromSortedCommands(commands) { // return max(highest clock in commands, current lamportClock) + lamport offset var lamportClock = this.lamportClock; if (commands.length === 0) { return lamportClock; } var lastCommand = commands[commands.length - 1]; var lastClock = lastCommand.clock; if (lastClock >= lamportClock) { return lastClock + this.LAMPORT_OFFSET; } return lamportClock; }, getNextCommandId: function getNextCommandId() { return this.lamportClock + "\\" + this.facade.getUserId(); }, /** util **/ getValuesFromDict: function getValuesFromDict(dict) { var values = []; for (var key in dict) { if (dict.hasOwnProperty(key)) { values.push(dict[key]); } } return values; }, inArray: function inArray(value, array) { for (var i = 0; i < array.length; i++) { if (array[i] === value) { return true; } } return false; } });
08to09-processwave
oryx/editor/client/scripts/Plugins/syncro.js
JavaScript
mit
8,486
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if(!ORYX.Plugins) { ORYX.Plugins = new Object(); } // Implements command class for a property change in the Core Commands object ORYX.Core.Commands["PropertyChange"] = ORYX.Core.AbstractCommand.extend({ construct: function construct(key, selectedElements, oldValues, newValue, facade){ // super constructor call arguments.callee.$.construct.call(this, facade); this.key = key; this.selectedElements = selectedElements; this.oldValues = oldValues; this.newValue = newValue; }, getAffectedShapes: function getAffectedShapes() { return this.selectedElements; }, getCommandName: function getCommandName() { return "PropertyChange"; }, getDisplayName: function getDisplayName() { return "Properties changed"; }, getCommandData: function getCommandData() { var selectedElementIds = []; for (var i = 0; i < this.selectedElements.length; i++) { selectedElementIds.push(this.selectedElements[i].resourceId); } var cmdData = { key: this.key, selectedElementIds: selectedElementIds, oldValues: this.oldValues, newValue: this.newValue }; return cmdData; }, createFromCommandData: function createFromCommandData(facade, cmdData) { var selectedElementObjs = []; var shapeExists = false; for(var i = 0; i < cmdData.selectedElementIds.length; i++) { var selectedShape = facade.getCanvas().getChildShapeOrCanvasByResourceId(cmdData.selectedElementIds[i]); if (typeof selectedShape !== 'undefined') { selectedElementObjs.push(selectedShape); shapeExists = true; } } // If no shape to be changed exists (i.e. it has been deleted) don't instantiate the command. if (!shapeExists) { return undefined; } return new ORYX.Core.Commands["PropertyChange"](cmdData.key, selectedElementObjs, cmdData.oldValues, cmdData.newValue, facade); }, execute: function execute(){ this.selectedElements.each(function(shape){ if(!shape.getStencil().property(this.key).readonly()) { shape.setProperty(this.key, this.newValue); } }.bind(this)); this.facade.getCanvas().update(); // TODO Moved from afterEdit(). Untested and not quite understood. What's with editDirectly()? this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED, elements: this.selectedElements, key: this.key, value: this.newValue }); }, rollback: function rollback(){ this.selectedElements.each(function(shape){ shape.setProperty(this.key, this.oldValues[shape.getId()]); }.bind(this)); if (this.isLocal()) { this.facade.setSelection(this.selectedElements); } this.facade.getCanvas().update(); } }); ORYX.Plugins.PropertyTab = { facade: undefined, construct: function(facade) { // Reference to the Editor-Interface this.facade = facade; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SHOW_PROPERTYWINDOW, this.init.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LOADED, this.selectDiagram.bind(this)); this.init(); }, init: function(){ // The parent div-node of the grid this.node = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", null, ['div']); // If the current property in focus is of type 'Date', the date format // is stored here. this.currentDateFormat; // the properties array this.popularProperties = []; this.properties = []; /* The currently selected shapes whos properties will shown */ this.shapeSelection = new Hash(); this.shapeSelection.shapes = new Array(); this.shapeSelection.commonProperties = new Array(); this.shapeSelection.commonPropertiesValues = new Hash(); this.updaterFlag = false; // creating the column model of the grid. this.columnModel = new Ext.grid.ColumnModel([ { //id: 'name', header: ORYX.I18N.PropertyWindow.name, dataIndex: 'name', width: 90, sortable: true, renderer: this.tooltipRenderer.bind(this) }, { //id: 'value', header: ORYX.I18N.PropertyWindow.value, dataIndex: 'value', id: 'propertywindow_column_value', width: 110, editor: new Ext.form.TextField({ allowBlank: false }), renderer: this.renderer.bind(this) }, { header: "Pop", dataIndex: 'popular', hidden: true, sortable: true } ]); // creating the store for the model. this.dataSource = new Ext.data.GroupingStore({ proxy: new Ext.data.MemoryProxy(this.properties), reader: new Ext.data.ArrayReader({}, [ {name: 'popular'}, {name: 'name'}, {name: 'value'}, {name: 'icons'}, {name: 'gridProperties'} ]), sortInfo: {field: 'popular', direction: "ASC"}, sortData : function(f, direction){ direction = direction || 'ASC'; var st = this.fields.get(f).sortType; var fn = function(r1, r2){ var v1 = st(r1.data[f]), v2 = st(r2.data[f]); var p1 = r1.data['popular'], p2 = r2.data['popular']; return p1 && !p2 ? -1 : (!p1 && p2 ? 1 : (v1 > v2 ? 1 : (v1 < v2 ? -1 : 0))); }; this.data.sort(direction, fn); if(this.snapshot && this.snapshot != this.data){ this.snapshot.sort(direction, fn); } }, groupField: 'popular' }); this.dataSource.load(); var propertiesDiv = document.createElement('div'); // Register the property tab in the sidebar this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB, 'tabid': 'pwave-properties', 'tabTitle': 'Properties', 'tabOrder': 2, 'tabDivEl': propertiesDiv, 'storeRenameFunction': function(fun) { this.onTabRename = fun; }.bind(this), 'forceExecution': true }); this.grid = new Ext.grid.EditorGridPanel({ renderTo: propertiesDiv, clicksToEdit: 1, stripeRows: true, //autoExpandColumn: "propertywindow_column_value", width: 'auto', maxHeight: 530, height: 'auto', border: false, header: true, // the column model colModel: this.columnModel, enableHdMenu: false, view: new Ext.grid.GroupingView({ forceFit: true, groupTextTpl: '{[values.rs.first().data.popular ? ORYX.I18N.PropertyWindow.oftenUsed : ORYX.I18N.PropertyWindow.moreProps]}' }), // the data store store: this.dataSource }); Ext.EventManager.onWindowResize(this.grid.doLayout, this.grid); // Register on Events this.grid.on('beforeedit', this.beforeEdit, this, true); this.grid.on('afteredit', this.afterEdit, this, true); this.grid.view.on('refresh', this.hideMoreAttrs, this, true); //this.grid.on(ORYX.CONFIG.EVENT_KEYDOWN, this.keyDown, this, true); // Renderer the Grid this.grid.enableColumnMove = false; //this.grid.render(); // Sort as Default the first column //this.dataSource.sort('name'); }, // Select the Canvas when the editor is ready selectDiagram: function() { this.shapeSelection.shapes = [this.facade.getCanvas()]; this.setPropertyWindowTitle(); this.identifyCommonProperties(); this.createProperties(); }, specialKeyDown: function(field, event) { // If there is a TextArea and the Key is an Enter if(field instanceof Ext.form.TextArea && event.button == ORYX.CONFIG.KEY_Code_enter) { // Abort the Event return false } }, tooltipRenderer: function(value, p, record) { /* Prepare tooltip */ p.cellAttr = 'title="' + record.data.gridProperties.tooltip + '"'; return value; }, renderer: function(value, p, record) { this.tooltipRenderer(value, p, record); if(value instanceof Date) { // TODO: Date-Schema is not generic value = value.dateFormat(ORYX.I18N.PropertyWindow.dateFormat); } else if(String(value).search("<a href='") < 0) { // Shows the Value in the Grid in each Line value = String(value).gsub("<", "&lt;"); value = String(value).gsub(">", "&gt;"); value = String(value).gsub("%", "&#37;"); value = String(value).gsub("&", "&amp;"); if(record.data.gridProperties.type == ORYX.CONFIG.TYPE_COLOR) { value = "<div class='prop-background-color' style='background-color:" + value + "' />"; } record.data.icons.each(function(each) { if(each.name == value) { if(each.icon) { value = "<img src='" + each.icon + "' /> " + value; } } }); } return value; }, beforeEdit: function(option) { var editorGrid = this.dataSource.getAt(option.row).data.gridProperties.editor; var editorRenderer = this.dataSource.getAt(option.row).data.gridProperties.renderer; if(editorGrid) { // Disable KeyDown this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN); option.grid.getColumnModel().setEditor(1, editorGrid); editorGrid.field.row = option.row; // Render the editor to the grid, therefore the editor is also available // for the first and last row editorGrid.render(this.grid); //option.grid.getColumnModel().setRenderer(1, editorRenderer); editorGrid.setSize(option.grid.getColumnModel().getColumnWidth(1), editorGrid.height); } else { return false; } var key = this.dataSource.getAt(option.row).data.gridProperties.propId; this.oldValues = new Hash(); this.shapeSelection.shapes.each(function(shape){ this.oldValues[shape.getId()] = shape.properties[key]; }.bind(this)); }, afterEdit: function(option) { //Ext1.0: option.grid.getDataSource().commitChanges(); option.grid.getStore().commitChanges(); var key = option.record.data.gridProperties.propId; var selectedElements = this.shapeSelection.shapes; var oldValues = this.oldValues; var newValue = option.value; var command = new ORYX.Core.Commands["PropertyChange"](key, selectedElements, oldValues, newValue, this.facade); this.facade.executeCommands([command]); }, // Cahnges made in the property window will be shown directly editDirectly:function(key, value){ this.shapeSelection.shapes.each(function(shape){ if(!shape.getStencil().property(key).readonly()) { shape.setProperty(key, value); //shape.update(); } }.bind(this)); /* Propagate changed properties */ var selectedElements = this.shapeSelection.shapes; this.facade.raiseEvent({ type : ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED, elements : selectedElements, key : key, value : value }); this.facade.getCanvas().update(); }, // if a field becomes invalid after editing the shape must be restored to the old value updateAfterInvalid : function(key) { this.shapeSelection.shapes.each(function(shape) { if(!shape.getStencil().property(key).readonly()) { shape.setProperty(key, this.oldValues[shape.getId()]); shape.update(); } }.bind(this)); this.facade.getCanvas().update(); }, dialogClosed: function(data) { var row = this.field ? this.field.row : this.row this.scope.afterEdit({ grid:this.scope.grid, record:this.scope.grid.getStore().getAt(row), value: data }) // reopen the text field of the complex list field again this.scope.grid.startEditing(row, this.col); }, /** * Changes the title of the property window panel according to the selected shapes. */ setPropertyWindowTitle: function() { var title; if (typeof this.onTabRename === "function") { if(this.shapeSelection.shapes.length == 1) { title = this.shapeSelection.shapes.first().getStencil().title(); } else { title = this.shapeSelection.shapes.length + ' ' + ORYX.I18N.PropertyWindow.selected; } title = ORYX.I18N.PropertyWindow.title + ' (' + title + ')'; this.onTabRename(title); } }, /** * Sets this.shapeSelection.commonPropertiesValues. * If the value for a common property is not equal for each shape the value * is left empty in the property window. */ setCommonPropertiesValues: function() { this.shapeSelection.commonPropertiesValues = new Hash(); this.shapeSelection.commonProperties.each(function(property){ var key = property.prefix() + "-" + property.id(); var emptyValue = false; var firstShape = this.shapeSelection.shapes.first(); this.shapeSelection.shapes.each(function(shape){ if(firstShape.properties[key] != shape.properties[key]) { emptyValue = true; } }.bind(this)); /* Set property value */ if(!emptyValue) { this.shapeSelection.commonPropertiesValues[key] = firstShape.properties[key]; } }.bind(this)); }, /** * Returns the set of stencils used by the passed shapes. */ getStencilSetOfSelection: function() { var stencils = new Hash(); this.shapeSelection.shapes.each(function(shape) { stencils[shape.getStencil().id()] = shape.getStencil(); }) return stencils; }, /** * Identifies the common Properties of the selected shapes. */ identifyCommonProperties: function() { this.shapeSelection.commonProperties.clear(); /* * A common property is a property, that is part of * the stencil definition of the first and all other stencils. */ var stencils = this.getStencilSetOfSelection(); var firstStencil = stencils.values().first(); var comparingStencils = stencils.values().without(firstStencil); if(comparingStencils.length == 0) { this.shapeSelection.commonProperties = firstStencil.properties(); } else { var properties = new Hash(); /* put all properties of on stencil in a Hash */ firstStencil.properties().each(function(property){ properties[property.namespace() + '-' + property.id() + '-' + property.type()] = property; }); /* Calculate intersection of properties. */ comparingStencils.each(function(stencil){ var intersection = new Hash(); stencil.properties().each(function(property){ if(properties[property.namespace() + '-' + property.id() + '-' + property.type()]){ intersection[property.namespace() + '-' + property.id() + '-' + property.type()] = property; } }); properties = intersection; }); this.shapeSelection.commonProperties = properties.values(); } }, onSelectionChanged: function(event) { // don't allow remote commands to change focus if (!event.isLocal) return; /* Event to call afterEdit method */ this.grid.stopEditing(); /* Selected shapes */ this.shapeSelection.shapes = event.elements; /* Case: nothing selected */ if(event.elements.length == 0) { this.shapeSelection.shapes = [this.facade.getCanvas()]; } /* subselection available */ if(event.subSelection){ this.shapeSelection.shapes = [event.subSelection]; } this.setPropertyWindowTitle(); this.identifyCommonProperties(); this.setCommonPropertiesValues(); // Create the Properties this.createProperties(); }, /** * Creates the properties for the ExtJS-Grid from the properties of the * selected shapes. */ createProperties: function() { this.properties = []; this.popularProperties = []; if(this.shapeSelection.commonProperties) { // add new property lines this.shapeSelection.commonProperties.each((function(pair, index) { var key = pair.prefix() + "-" + pair.id(); // Get the property pair var name = pair.title(); var icons = []; var attribute = this.shapeSelection.commonPropertiesValues[key]; var editorGrid = undefined; var editorRenderer = null; var refToViewFlag = false; if(!pair.readonly()){ switch(pair.type()) { case ORYX.CONFIG.TYPE_STRING: // If the Text is MultiLine if(pair.wrapLines()) { // Set the Editor as TextArea var editorTextArea = new Ext.form.TextArea({alignment: "tl-tl", allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length()}); editorTextArea.on('keyup', function(textArea, event) { this.editDirectly(key, textArea.getValue()); }.bind(this)); editorGrid = new Ext.Editor(editorTextArea); } else { // If not, set the Editor as InputField var editorInput = new Ext.form.TextField({allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length()}); editorInput.on('keyup', function(input, event) { this.editDirectly(key, input.getValue()); }.bind(this)); // reverts the shape if the editor field is invalid editorInput.on('blur', function(input) { if(!input.isValid(false)) this.updateAfterInvalid(key); }.bind(this)); editorInput.on("specialkey", function(input, e) { if(!input.isValid(false)) this.updateAfterInvalid(key); }.bind(this)); editorGrid = new Ext.Editor(editorInput); } break; case ORYX.CONFIG.TYPE_BOOLEAN: // Set the Editor as a CheckBox var editorCheckbox = new Ext.form.Checkbox(); editorCheckbox.on('check', function(c,checked) { this.editDirectly(key, checked); }.bind(this)); editorGrid = new Ext.Editor(editorCheckbox); break; case ORYX.CONFIG.TYPE_INTEGER: // Set as an Editor for Integers var numberField = new Ext.form.NumberField({allowBlank: pair.optional(), allowDecimals:false, msgTarget:'title', minValue: pair.min(), maxValue: pair.max()}); numberField.on('keyup', function(input, event) { this.editDirectly(key, input.getValue()); }.bind(this)); editorGrid = new Ext.Editor(numberField); break; case ORYX.CONFIG.TYPE_FLOAT: // Set as an Editor for Float var numberField = new Ext.form.NumberField({ allowBlank: pair.optional(), allowDecimals:true, msgTarget:'title', minValue: pair.min(), maxValue: pair.max()}); numberField.on('keyup', function(input, event) { this.editDirectly(key, input.getValue()); }.bind(this)); editorGrid = new Ext.Editor(numberField); break; case ORYX.CONFIG.TYPE_COLOR: // Set as a ColorPicker // Ext1.0 editorGrid = new gEdit(new form.ColorField({ allowBlank: pair.optional(), msgTarget:'title' })); var editorPicker = new Ext.ux.ColorField({ allowBlank: pair.optional(), msgTarget:'title', facade: this.facade }); /*this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COLOR_CHANGE, function(option) { this.editDirectly(key, option.value); }.bind(this));*/ editorGrid = new Ext.Editor(editorPicker); break; case ORYX.CONFIG.TYPE_CHOICE: var items = pair.items(); var options = []; items.each(function(value) { if(value.value() == attribute) attribute = value.title(); if(value.refToView()[0]) refToViewFlag = true; options.push([value.icon(), value.title(), value.value()]); icons.push({ name: value.title(), icon: value.icon() }); }); var store = new Ext.data.SimpleStore({ fields: [{name: 'icon'}, {name: 'title'}, {name: 'value'} ], data : options // from states.js }); // Set the grid Editor var editorCombo = new Ext.form.ComboBox({ tpl: '<tpl for="."><div class="x-combo-list-item">{[(values.icon) ? "<img src=\'" + values.icon + "\' />" : ""]} {title}</div></tpl>', store: store, displayField:'title', valueField: 'value', typeAhead: true, mode: 'local', triggerAction: 'all', selectOnFocus:true }); editorCombo.on('select', function(combo, record, index) { this.editDirectly(key, combo.getValue()); }.bind(this)) editorGrid = new Ext.Editor(editorCombo); break; case ORYX.CONFIG.TYPE_DATE: var currFormat = ORYX.I18N.PropertyWindow.dateFormat if(!(attribute instanceof Date)) attribute = Date.parseDate(attribute, currFormat) editorGrid = new Ext.Editor(new Ext.form.DateField({ allowBlank: pair.optional(), format:currFormat, msgTarget:'title'})); break; case ORYX.CONFIG.TYPE_TEXT: var cf = new Ext.form.ComplexTextField({ allowBlank: pair.optional(), dataSource:this.dataSource, grid:this.grid, row:index, facade:this.facade }); cf.on('dialogClosed', this.dialogClosed, {scope:this, row:index, col:1,field:cf}); editorGrid = new Ext.Editor(cf); break; // extended by Kerstin (start) case ORYX.CONFIG.TYPE_COMPLEX: var cf = new Ext.form.ComplexListField({ allowBlank: pair.optional()}, pair.complexItems(), key, this.facade); cf.on('dialogClosed', this.dialogClosed, {scope:this, row:index, col:1,field:cf}); editorGrid = new Ext.Editor(cf); break; // extended by Kerstin (end) default: var editorInput = new Ext.form.TextField({ allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length(), enableKeyEvents: true}); editorInput.on('keyup', function(input, event) { this.editDirectly(key, input.getValue()); }.bind(this)); editorGrid = new Ext.Editor(editorInput); } // Register Event to enable KeyDown editorGrid.on('beforehide', this.facade.enableEvent.bind(this, ORYX.CONFIG.EVENT_KEYDOWN)); editorGrid.on('specialkey', this.specialKeyDown.bind(this)); } else if(pair.type() === ORYX.CONFIG.TYPE_URL || pair.type() === ORYX.CONFIG.TYPE_DIAGRAM_LINK){ attribute = String(attribute).search("http") !== 0 ? ("http://" + attribute) : attribute; attribute = "<a href='" + attribute + "' target='_blank'>" + attribute.split("://")[1] + "</a>" } // Push to the properties-array if(pair.visible()) { // Popular Properties are those with a refToView set or those which are set to be popular if (pair.refToView()[0] || refToViewFlag || pair.popular()) { pair.setPopular(); } if(pair.popular()) { this.popularProperties.push([pair.popular(), name, attribute, icons, { editor: editorGrid, propId: key, type: pair.type(), tooltip: pair.description(), renderer: editorRenderer }]); } else { this.properties.push([pair.popular(), name, attribute, icons, { editor: editorGrid, propId: key, type: pair.type(), tooltip: pair.description(), renderer: editorRenderer }]); } } }).bind(this)); } this.setProperties(); }, hideMoreAttrs: function(panel) { // TODO: Implement the case that the canvas has no attributes if (this.properties.length <= 0){ return } // collapse the "more attr" group this.grid.view.toggleGroup(this.grid.view.getGroupId(this.properties[0][0]), false); // prevent the more attributes pane from closing after a attribute has been edited this.grid.view.un("refresh", this.hideMoreAttrs, this); }, setProperties: function() { var props = this.popularProperties.concat(this.properties); this.dataSource.loadData(props); } } ORYX.Plugins.PropertyTab = Clazz.extend(ORYX.Plugins.PropertyTab); /** * Editor for complex type * * When starting to edit the editor, it creates a new dialog where new attributes * can be specified which generates json out of this and put this * back to the input field. * * This is implemented from Kerstin Pfitzner * * @param {Object} config * @param {Object} items * @param {Object} key * @param {Object} facade */ Ext.form.ComplexListField = function(config, items, key, facade){ Ext.form.ComplexListField.superclass.constructor.call(this, config); this.items = items; this.key = key; this.facade = facade; }; /** * This is a special trigger field used for complex properties. * The trigger field opens a dialog that shows a list of properties. * The entered values will be stored as trigger field value in the JSON format. */ Ext.extend(Ext.form.ComplexListField, Ext.form.TriggerField, { /** * @cfg {String} triggerClass * An additional CSS class used to style the trigger button. The trigger will always get the * class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified. */ triggerClass: 'x-form-complex-trigger', readOnly: true, emptyText: ORYX.I18N.PropertyWindow.clickIcon, /** * Builds the JSON value from the data source of the grid in the dialog. */ buildValue: function() { var ds = this.grid.getStore(); ds.commitChanges(); if (ds.getCount() == 0) { return ""; } var jsonString = "["; for (var i = 0; i < ds.getCount(); i++) { var data = ds.getAt(i); jsonString += "{"; for (var j = 0; j < this.items.length; j++) { var key = this.items[j].id(); jsonString += key + ':' + ("" + data.get(key)).toJSON(); if (j < (this.items.length - 1)) { jsonString += ", "; } } jsonString += "}"; if (i < (ds.getCount() - 1)) { jsonString += ", "; } } jsonString += "]"; jsonString = "{'totalCount':" + ds.getCount().toJSON() + ", 'items':" + jsonString + "}"; return Object.toJSON(jsonString.evalJSON()); }, /** * Returns the field key. */ getFieldKey: function() { return this.key; }, /** * Returns the actual value of the trigger field. * If the table does not contain any values the empty * string will be returned. */ getValue : function(){ // return actual value if grid is active if (this.grid) { return this.buildValue(); } else if (this.data == undefined) { return ""; } else { return this.data; } }, /** * Sets the value of the trigger field. * In this case this sets the data that will be shown in * the grid of the dialog. * * @param {Object} value The value to be set (JSON format or empty string) */ setValue: function(value) { if (value.length > 0) { // set only if this.data not set yet // only to initialize the grid if (this.data == undefined) { this.data = value; } } }, /** * Returns false. In this way key events will not be propagated * to other elements. * * @param {Object} event The keydown event. */ keydownHandler: function(event) { return false; }, /** * The listeners of the dialog. * * If the dialog is hidded, a dialogClosed event will be fired. * This has to be used by the parent element of the trigger field * to reenable the trigger field (focus gets lost when entering values * in the dialog). */ dialogListeners : { show : function(){ // retain focus styling this.onFocus(); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_KEYDOWN, this.keydownHandler.bind(this)); this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN); return; }, hide : function(){ var dl = this.dialogListeners; this.dialog.un("show", dl.show, this); this.dialog.un("hide", dl.hide, this); this.dialog.destroy(true); this.grid.destroy(true); delete this.grid; delete this.dialog; this.facade.unregisterOnEvent(ORYX.CONFIG.EVENT_KEYDOWN, this.keydownHandler.bind(this)); this.facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN); // store data and notify parent about the closed dialog // parent has to handel this event and start editing the text field again this.fireEvent('dialogClosed', this.data); Ext.form.ComplexListField.superclass.setValue.call(this, this.data); } }, /** * Builds up the initial values of the grid. * * @param {Object} recordType The record type of the grid. * @param {Object} items The initial items of the grid (columns) */ buildInitial: function(recordType, items) { var initial = new Hash(); for (var i = 0; i < items.length; i++) { var id = items[i].id(); initial[id] = items[i].value(); } var RecordTemplate = Ext.data.Record.create(recordType); return new RecordTemplate(initial); }, /** * Builds up the column model of the grid. The parent element of the * grid. * * Sets up the editors for the grid columns depending on the * type of the items. * * @param {Object} parent The */ buildColumnModel: function(parent) { var cols = []; for (var i = 0; i < this.items.length; i++) { var id = this.items[i].id(); var header = this.items[i].name(); var width = this.items[i].width(); var type = this.items[i].type(); var editor; if (type == ORYX.CONFIG.TYPE_STRING) { editor = new Ext.form.TextField({ allowBlank : this.items[i].optional(), width : width}); } else if (type == ORYX.CONFIG.TYPE_CHOICE) { var items = this.items[i].items(); var select = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", parent, ['select', {style:'display:none'}]); var optionTmpl = new Ext.Template('<option value="{value}">{value}</option>'); items.each(function(value){ optionTmpl.append(select, {value:value.value()}); }); editor = new Ext.form.ComboBox( { typeAhead: true, triggerAction: 'all', transform:select, lazyRender:true, msgTarget:'title', width : width}); } else if (type == ORYX.CONFIG.TYPE_BOOLEAN) { editor = new Ext.form.Checkbox( { width : width } ); } cols.push({ id: id, header: header, dataIndex: id, resizable: true, editor: editor, width: width }); } return new Ext.grid.ColumnModel(cols); }, /** * After a cell was edited the changes will be commited. * * @param {Object} option The option that was edited. */ afterEdit: function(option) { option.grid.getStore().commitChanges(); }, /** * Before a cell is edited it has to be checked if this * cell is disabled by another cell value. If so, the cell editor will * be disabled. * * @param {Object} option The option to be edited. */ beforeEdit: function(option) { var state = this.grid.getView().getScrollState(); var col = option.column; var row = option.row; var editId = this.grid.getColumnModel().config[col].id; // check if there is an item in the row, that disables this cell for (var i = 0; i < this.items.length; i++) { // check each item that defines a "disable" property var item = this.items[i]; var disables = item.disable(); if (disables != undefined) { // check if the value of the column of this item in this row is equal to a disabling value var value = this.grid.getStore().getAt(row).get(item.id()); for (var j = 0; j < disables.length; j++) { var disable = disables[j]; if (disable.value == value) { for (var k = 0; k < disable.items.length; k++) { // check if this value disables the cell to select // (id is equals to the id of the column to edit) var disItem = disable.items[k]; if (disItem == editId) { this.grid.getColumnModel().getCellEditor(col, row).disable(); return; } } } } } } this.grid.getColumnModel().getCellEditor(col, row).enable(); //this.grid.getView().restoreScroll(state); }, /** * If the trigger was clicked a dialog has to be opened * to enter the values for the complex property. */ onTriggerClick : function(){ if(this.disabled){ return; } //if(!this.dialog) { var dialogWidth = 0; var recordType = []; for (var i = 0; i < this.items.length; i++) { var id = this.items[i].id(); var width = this.items[i].width(); var type = this.items[i].type(); if (type == ORYX.CONFIG.TYPE_CHOICE) { type = ORYX.CONFIG.TYPE_STRING; } dialogWidth += width; recordType[i] = {name:id, type:type}; } if (dialogWidth > 800) { dialogWidth = 800; } dialogWidth += 22; var data = this.data; if (data == "") { // empty string can not be parsed data = "{}"; } var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(eval("(" + data + ")")), reader: new Ext.data.JsonReader({ root: 'items', totalProperty: 'totalCount' }, recordType) }); ds.load(); var cm = this.buildColumnModel(); this.grid = new Ext.grid.EditorGridPanel({ store: ds, cm: cm, stripeRows: true, clicksToEdit : 1, autoHeight:true, selModel: new Ext.grid.CellSelectionModel() }); //var gridHead = this.grid.getView().getHeaderPanel(true); var toolbar = new Ext.Toolbar( [{ text: ORYX.I18N.PropertyWindow.add, handler: function(){ var ds = this.grid.getStore(); var index = ds.getCount(); this.grid.stopEditing(); var p = this.buildInitial(recordType, this.items); ds.insert(index, p); ds.commitChanges(); this.grid.startEditing(index, 0); }.bind(this) },{ text: ORYX.I18N.PropertyWindow.rem, handler : function(){ var ds = this.grid.getStore(); var selection = this.grid.getSelectionModel().getSelectedCell(); if (selection == undefined) { return; } this.grid.getSelectionModel().clearSelections(); this.grid.stopEditing(); var record = ds.getAt(selection[0]); ds.remove(record); ds.commitChanges(); }.bind(this) }]); // Basic Dialog this.dialog = new Ext.Window({ autoScroll: true, autoCreate: true, title: ORYX.I18N.PropertyWindow.complex, height: 350, width: dialogWidth, modal:true, collapsible:false, fixedcenter: true, shadow:true, proxyDrag: true, keys:[{ key: 27, fn: function(){ this.dialog.hide }.bind(this) }], items:[toolbar, this.grid], bodyStyle:"background-color:#FFFFFF", buttons: [{ text: ORYX.I18N.PropertyWindow.ok, handler: function(){ this.grid.stopEditing(); // store dialog input this.data = this.buildValue(); this.dialog.hide() }.bind(this) }, { text: ORYX.I18N.PropertyWindow.cancel, handler: function(){ this.dialog.hide() }.bind(this) }] }); this.dialog.on(Ext.apply({}, this.dialogListeners, { scope:this })); this.dialog.show(); this.grid.on('beforeedit', this.beforeEdit, this, true); this.grid.on('afteredit', this.afterEdit, this, true); this.grid.render(); /*} else { this.dialog.show(); }*/ } }); // Override for maxHeight in GridPanel Ext.grid.GridView.override({ layout : function(){ if(!this.mainBody){ return; // not rendered } var g = this.grid; var c = g.getGridEl(); var csize = c.getSize(true); var vw = csize.width; if(vw < 20 || csize.height < 20){ // display: none? return; } if(g.autoHeight){ if (g.maxHeight) { var hdHeight = this.mainHd.getHeight(); var vh = Math.min(csize.height, g.maxHeight); this.el.setSize(csize.width, vh); this.scroller.setSize(vw, vh - hdHeight); } else { this.scroller.dom.style.overflow = 'visible'; } }else{ this.el.setSize(csize.width, csize.height); var hdHeight = this.mainHd.getHeight(); var vh = csize.height - (hdHeight); this.scroller.setSize(vw, vh); if(this.innerHd){ this.innerHd.style.width = (vw)+'px'; } } if(this.forceFit){ if(this.lastViewWidth != vw){ this.fitColumns(false, false); this.lastViewWidth = vw; } }else { this.autoExpand(); this.syncHeaderScroll(); } this.onLayout(vw, vh); } }); Ext.form.ComplexTextField = Ext.extend(Ext.form.TriggerField, { defaultAutoCreate : {tag: "textarea", rows:1, style:"height:16px;overflow:hidden;" }, /** * If the trigger was clicked a dialog has to be opened * to enter the values for the complex property. */ onTriggerClick : function(){ if(this.disabled){ return; } var grid = new Ext.form.TextArea({ anchor : '100% 100%', value : this.value, listeners : { focus: function(){ this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN); }.bind(this) } }) // Basic Dialog var dialog = new Ext.Window({ layout : 'anchor', autoCreate : true, title : ORYX.I18N.PropertyWindow.text, height : 500, width : 500, modal : true, collapsible : false, fixedcenter : true, shadow : true, proxyDrag : true, keys:[{ key : 27, fn : function(){ dialog.hide() }.bind(this) }], items :[grid], listeners :{ hide: function(){ this.fireEvent('dialogClosed', this.value); //this.focus.defer(10, this); dialog.destroy(); }.bind(this) }, buttons : [{ text: ORYX.I18N.PropertyWindow.ok, handler: function(){ // store dialog input var value = grid.getValue(); this.setValue(value); this.dataSource.getAt(this.row).set('value', value) this.dataSource.commitChanges() dialog.hide() }.bind(this) }, { text: ORYX.I18N.PropertyWindow.cancel, handler: function(){ this.setValue(this.value); dialog.hide() }.bind(this) }] }); dialog.show(); grid.render(); this.grid.stopEditing(); grid.focus( false, 100 ); } });
08to09-processwave
oryx/editor/client/scripts/Plugins/propertytab.js
JavaScript
mit
41,520
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if (!ORYX.Plugins) { ORYX.Plugins = new Object(); } ORYX.Core.Commands["ShapeRepository.DropCommand"] = ORYX.Core.AbstractCommand.extend({ construct: function construct(option, currentParent, canAttach, position, facade) { // call construct method of parent arguments.callee.$.construct.call(this, facade); this.option = option; this.currentParent = currentParent; this.canAttach = canAttach; this.position = position; this.selection = this.facade.getSelection(); this.shape; this.parent; }, getAffectedShapes: function getAffectedShapes() { if (typeof this.shape !== "undefined") { return [this.shape]; } return []; }, getCommandName: function getCommandName() { return "ShapeRepository.DropCommand"; }, getDisplayName: function getDisplayName() { return "Shape created"; }, getCommandData: function getCommandData() { var commandData = { id : this.shape.id, resourceId : this.shape.resourceId, parent : this.parent.resourceId, currentParent : this.currentParent.resourceId, position: this.position, optionsPosition : this.option.position, namespace : this.option.namespace, type : this.option.type, canAttach : this.canAttach }; return commandData; }, createFromCommandData: function createFromCommandData(facade, commandData) { var currentParent = facade.getCanvas().getChildShapeOrCanvasByResourceId(commandData.currentParent); var parent = facade.getCanvas().getChildShapeOrCanvasByResourceId(commandData.parent); // Checking if the shape we drop the new shape into still exists. if (typeof parent === 'undefined' || typeof currentParent === 'undefined' ) { return undefined; } var options = { 'shapeOptions': { 'id': commandData.id, 'resourceId': commandData.resourceId }, 'position': commandData.optionsPosition, 'namespace': commandData.namespace, 'type': commandData.type }; options.parent = parent; return new ORYX.Core.Commands["ShapeRepository.DropCommand"](options, currentParent, commandData.canAttach, commandData.position, facade); }, execute: function execute() { if (!this.shape) { this.shape = this.facade.createShape(this.option); this.parent = this.shape.parent; } else { this.parent.add(this.shape); } if (this.canAttach && this.currentParent instanceof ORYX.Core.Node && this.shape.dockers.length > 0) { var docker = this.shape.dockers[0]; if (this.currentParent.parent instanceof ORYX.Core.Node) { this.currentParent.parent.add( docker.parent ); } var relativePosition = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint(); relativePosition.x = (this.currentParent.absoluteBounds().lowerRight().x - this.position.x) / this.currentParent.bounds.width(); relativePosition.y = (this.currentParent.absoluteBounds().lowerRight().y - this.position.y) / this.currentParent.bounds.height(); var absolutePosition; if (typeof this.currentParent !== "undefined") { absolutePosition = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint(); if ((0 > relativePosition.x) || (relativePosition.x > 1) || (0 > relativePosition.y) || (relativePosition.y > 1)) { relativePosition.x = 0; relativePosition.y = 0; } absolutePosition.x = Math.abs(this.currentParent.absoluteBounds().lowerRight().x - relativePosition.x * this.currentParent.bounds.width()); absolutePosition.y = Math.abs(this.currentParent.absoluteBounds().lowerRight().y - relativePosition.y * this.currentParent.bounds.height()); } else { absolutePosition = relativePosition; } docker.bounds.centerMoveTo(absolutePosition); docker.setDockedShape( this.currentParent ); } this.facade.getCanvas().update(); this.facade.updateSelection(this.isLocal()); }, rollback: function rollback() { // If syncro tells us to revert a command, we have to pick necessary references ourselves. if (typeof this.shape === 'undefined') { this.shape = this.facade.getCanvas().getChildShapeByResourceId(this.option.shapeOptions.resourceId); if (typeof this.shape === 'undefined') { throw "Could not revert Shaperepository.DropCommand. this.shape is undefined."; } } this.facade.deleteShape(this.shape); this.facade.raiseEvent( { "type": ORYX.CONFIG.EVENT_SHAPEDELETED, "shape": this.shape } ); var selectedShapes = this.facade.getSelection(); var newSelectedShapes = selectedShapes.without(this.shape); this.facade.getCanvas().update(); if (this.isLocal()) { this.facade.setSelection(newSelectedShapes); } else { var isDragging = this.facade.isDragging(); if (!isDragging) { this.facade.setSelection(newSelectedShapes); } else { //raise event, which assures, that selection and canvas will be updated after dragging is finished this.facade.raiseEvent( { "type": ORYX.CONFIG.EVENT_SHAPESTODELETE, "deletedShapes": [this.shape] } ); } } this.facade.updateSelection(this.isLocal()); } }); ORYX.Plugins.NewShapeRepository = { construct: function(facade) { arguments.callee.$.construct.call(this, facade); // super() this.facade = facade; this._currentParent; this._canContain = undefined; this._canAttach = undefined; this.canvasContainer = $$(".ORYX_Editor")[0].parentNode; this.shapeList = document.createElement('div'); this.shapeList.id = 'pwave-repository'; this.canvasContainer.appendChild(this.shapeList); this.groupStencils = []; // Create a Drag-Zone for Drag'n'Drop var dragZone = new Ext.dd.DragZone(this.shapeList, {shadow: !Ext.isMac, hasOuterHandles: true}); dragZone.onDrag = function() { this.groupStencils.each(this._hideGroupStencil); }.bind(this); dragZone.afterDragDrop = this.drop.bind(this, dragZone); dragZone.beforeDragOver = this.beforeDragOver.bind(this, dragZone); dragZone.beforeDragEnter = function() { this._lastOverElement = false; return true; }.bind(this); // Load all Stencilssets this.setStencilSets(); this.hoverTimeout = undefined; this.timesHidden = 0; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_STENCIL_SET_LOADED, this.setStencilSets.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this._handleModeChanged.bind(this)); }, _handleModeChanged: function _handleModeChanged(event) { this._setVisibility(event.mode.isEditMode() && !event.mode.isPaintMode()); }, getVisibleCanvasHeight: function getVisibleCanvasHeight() { var canvasContainer = $$(".ORYX_Editor")[0].parentNode; return canvasContainer.offsetHeight; }, /** * Load all stencilsets in the shaperepository */ setStencilSets: function() { // Remove all childs var child = this.shapeList.firstChild; while(child) { this.shapeList.removeChild(child); child = this.shapeList.firstChild; } // Go thru all Stencilsets and stencils this.facade.getStencilSets().values().each((function(sset) { var typeTitle = sset.title(); var extensions = sset.extensions(); if (extensions && extensions.size() > 0) { typeTitle += " / " + ORYX.Core.StencilSet.getTranslation(extensions.values()[0], "title"); } // For each Stencilset create and add a new Tree-Node var stencilSetNode = document.createElement('div'); this.shapeList.appendChild(stencilSetNode); // Get Stencils from Stencilset var stencils = sset.stencils(this.facade.getCanvas().getStencil(), this.facade.getRules()); var treeGroups = new Hash(); // Sort the stencils according to their position and add them to the repository stencils = stencils.sortBy(function(value) { return value.position(); } ); stencils.each((function(stencil) { var groups = stencil.groups(); groups.each((function(group) { var firstInGroup = !treeGroups[group]; var groupStencil = undefined; if(firstInGroup) { // add large shape icon to shape repository groupStencil = this.createGroupStencilNode(stencilSetNode, stencil, group); // Create a new group var groupElement = this.createGroupElement(groupStencil, group); treeGroups[group] = groupElement; this.addGroupStencilHoverListener(groupStencil); this.groupStencils.push(groupStencil); } // Create the Stencil-Tree-Node var stencilTreeNode = this.createStencilTreeNode(treeGroups[group], stencil); var handles = []; for (var i = 0; i < stencilTreeNode.childNodes.length; i++) { handles.push(stencilTreeNode.childNodes[i]); } if (firstInGroup) { handles.push(groupStencil.firstChild); } // Register the Stencil on Drag and Drop Ext.dd.Registry.register(stencilTreeNode, { 'handles': handles, // Set the Handles 'isHandle': true, 'type': stencil.id(), // Set Type of stencil namespace: stencil.namespace() // Set Namespace of stencil }); }).bind(this)); }).bind(this)); }).bind(this)); }, addGroupStencilHoverListener: function addGroupStencilHoverListener(groupStencil) { var timer = {}; var hideGroupElement = function hideGroupElement(event) { // Hide the extended groupElement if the mouse is not moving to the groupElement clearTimeout(timer); this._hideGroupStencil(groupStencil); }.bind(this); var handleMouseOver = function handleMouseOver(event) { var showGroupElement = function showGroupElement() { var groupElement = jQuery(groupStencil).children(".new-repository-group"); var groupLeftBar = jQuery(groupElement).children(".new-repository-group-left-bar"); var groupHeader = jQuery(groupElement).children(".new-repository-group-header"); var stencilBoundingRect = groupStencil.getBoundingClientRect(); groupElement.css('top', stencilBoundingRect.top + 'px'); groupElement.css('left', stencilBoundingRect.right - 1 + 'px'); groupElement.addClass('new-repository-group-visible'); // Position the groupElement so its lower bound is not lower than 460px var groupBoundingRect = groupHeader[0].getBoundingClientRect(); var lowestPosition = 530; if (groupBoundingRect.bottom > lowestPosition) { var invisibleOffset = groupBoundingRect.bottom - lowestPosition; groupElement.css('top', groupBoundingRect.top - invisibleOffset + 'px'); groupLeftBar.css('height', stencilBoundingRect.bottom + 1 - groupElement.position().top + 'px'); // +1 for border } }; timer = setTimeout(showGroupElement, 500); }; jQuery(groupStencil).bind('mouseenter', handleMouseOver); jQuery(groupStencil).bind('mouseleave', hideGroupElement); }, createGroupStencilNode: function createGroupStencilNode(parentTreeNode, stencil, groupname) { // Create and add the Stencil to the Group var newElement = document.createElement('div'); newElement.className = 'new-repository-group-stencil'; var stencilImage = document.createElement('div'); stencilImage.className = 'new-repository-group-stencil-bg'; stencilImage.style.backgroundImage = 'url(' + stencil.bigIcon() + ')'; newElement.appendChild(stencilImage); parentTreeNode.appendChild(newElement); return newElement; }, createStencilTreeNode: function createStencilTreeNode(parentTreeNode, stencil) { // Create and add the Stencil to the Group var newRow = jQuery('<div class="new-repository-group-row"></div>'); newRow.append('<div class="new-repository-group-row-lefthighlight"></div>'); var entry = jQuery('<div class="new-repository-group-row-entry"></div>'); // entry.attr("title", stencil.description()); no tooltips var icon = jQuery('<img></img>'); icon.attr('src', stencil.icon()); entry.append(icon); entry.append(stencil.title()); newRow.append(entry); newRow.append('<div class="new-repository-group-row-righthighlight"></div>'); jQuery(parentTreeNode).find(".new-repository-group-entries:first").append(newRow); return entry[0]; }, createGroupElement: function createGroupElement(groupStencilNode, group) { // Create the div that appears on the right side of the shape repository containing additional shapes of the group. var groupElement = jQuery("<div class='new-repository-group'>" + // left bar "<div class='new-repository-group-left-bar'>" + "<div class='new-repository-group-left-bar-bottom-gradient'></div>" + "<div class='new-repository-group-left-bar-bottom-highlight'></div>" + "</div>" + // header "<div class='new-repository-group-header'>" + "<div style='position: relative; width: 100%'>" + "<div class='new-repository-group-header-left-highlight'></div>" + "<div class='new-repository-group-header-label'></div>" + "<div class='new-repository-group-header-right-highlight'></div>" + "<div class='new-repository-group-content'>" + "<div class='new-repository-group-entries'></div>" + "</div>" + "</div>" + "</div>" + "</div>" ); groupElement.find(".new-repository-group-header-label").text(group); // Add the Group to the ShapeRepository jQuery(groupStencilNode).append(groupElement); return groupElement[0]; }, _hideGroupStencil: function _hideGroupStencil(groupStencil) { var groupElement = jQuery(groupStencil).children(".new-repository-group:first"); groupElement.removeClass('new-repository-group-visible'); }, drop: function(dragZone, target, event) { this._lastOverElement = undefined; // Hide the highlighting this.facade.raiseEvent({type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:'shapeRepo.added'}); this.facade.raiseEvent({type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:'shapeRepo.attached'}); // Check if drop is allowed var proxy = dragZone.getProxy(); if(proxy.dropStatus == proxy.dropNotAllowed) { return; } // Check if there is a current Parent if(!this._currentParent) { return; } var option = Ext.dd.Registry.getHandle(target.DDM.currentTarget); // Make sure, that the shapeOptions of the last DropCommand are not reused. option.shapeOptions = undefined; var xy = event.getXY(); var pos = {x: xy[0], y: xy[1]}; var a = this.facade.getCanvas().node.getScreenCTM(); // Correcting the UpperLeft-Offset pos.x -= a.e; pos.y -= a.f; // Correcting the Zoom-Faktor pos.x /= a.a; pos.y /= a.d; // Correting the ScrollOffset pos.x -= document.documentElement.scrollLeft; pos.y -= document.documentElement.scrollTop; // Correct position of parent var parentAbs = this._currentParent.absoluteXY(); pos.x -= parentAbs.x; pos.y -= parentAbs.y; // Set position option['position'] = pos; // Set parent if( this._canAttach && this._currentParent instanceof ORYX.Core.Node ){ option['parent'] = undefined; } else { option['parent'] = this._currentParent; } var position = this.facade.eventCoordinates( event.browserEvent ); var command = new ORYX.Core.Commands["ShapeRepository.DropCommand"](option, this._currentParent, this._canAttach, position, this.facade); this.facade.executeCommands([command]); this._currentParent = undefined; }, beforeDragOver: function(dragZone, target, event){ var pr; var coord = this.facade.eventCoordinates(event.browserEvent); var aShapes = this.facade.getCanvas().getAbstractShapesAtPosition( coord ); if(aShapes.length <= 0) { pr = dragZone.getProxy(); pr.setStatus(pr.dropNotAllowed); pr.sync(); return false; } var el = aShapes.last(); if(aShapes.lenght == 1 && aShapes[0] instanceof ORYX.Core.Canvas) { return false; } else { // check containment rules var option = Ext.dd.Registry.getHandle(target.DDM.currentTarget); var stencilSet = this.facade.getStencilSets()[option.namespace]; var stencil = stencilSet.stencil(option.type); if(stencil.type() === "node") { var parentCandidate = aShapes.reverse().find(function(candidate) { return (candidate instanceof ORYX.Core.Canvas || candidate instanceof ORYX.Core.Node || candidate instanceof ORYX.Core.Edge); }); if (parentCandidate !== this._lastOverElement) { this._canAttach = undefined; this._canContain = undefined; } if( parentCandidate ) { //check containment rule if (!(parentCandidate instanceof ORYX.Core.Canvas) && parentCandidate.isPointOverOffset(coord.x, coord.y) && this._canAttach == undefined) { this._canAttach = this.facade.getRules().canConnect({ sourceShape: parentCandidate, edgeStencil: stencil, targetStencil: stencil }); if( this._canAttach ){ // Show Highlight this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW, highlightId: "shapeRepo.attached", elements: [parentCandidate], style: ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_RECTANGLE, color: ORYX.CONFIG.SELECTION_VALID_COLOR }); this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId: "shapeRepo.added" }); this._canContain = undefined; } } if(!(parentCandidate instanceof ORYX.Core.Canvas) && !parentCandidate.isPointOverOffset(coord.x, coord.y)){ this._canAttach = this._canAttach == false ? this._canAttach : undefined; } if( this._canContain == undefined && !this._canAttach) { this._canContain = this.facade.getRules().canContain({ containingShape:parentCandidate, containedStencil:stencil }); // Show Highlight this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW, highlightId:'shapeRepo.added', elements: [parentCandidate], color: this._canContain ? ORYX.CONFIG.SELECTION_VALID_COLOR : ORYX.CONFIG.SELECTION_INVALID_COLOR }); this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:"shapeRepo.attached" }); } this._currentParent = this._canContain || this._canAttach ? parentCandidate : undefined; this._lastOverElement = parentCandidate; pr = dragZone.getProxy(); pr.setStatus(this._currentParent ? pr.dropAllowed : pr.dropNotAllowed ); pr.sync(); } } else { //Edge this._currentParent = this.facade.getCanvas(); pr = dragZone.getProxy(); pr.setStatus(pr.dropAllowed); pr.sync(); } } return false; }, _setVisibility: function _setVisibility(show) { if (show) { this.shapeList.show(); } else { this.shapeList.hide(); } } }; ORYX.Plugins.NewShapeRepository = Clazz.extend(ORYX.Plugins.NewShapeRepository);
08to09-processwave
oryx/editor/client/scripts/Plugins/newshaperepository.js
JavaScript
mit
25,212
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if (!ORYX.Plugins) ORYX.Plugins = new Object(); /** * This implements the interface between the syncro algorithm (syncro.js) * and the Oryx editor **/ ORYX.Plugins.SyncroOryx = Clazz.extend({ facade: undefined, debug: false, //Set to true to see Apply/Revert-Log in console construct: function construct(facade) { this.facade = facade; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS, this.handleNewRemoteCommands.bind(this)); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED, this.handleAfterCommandsExecuted.bind(this)); }, /** Direction: Wave -> Oryx (New remote commands in Wave State) **/ handleNewRemoteCommands: function handleNewRemoteCommands(event) { this.newCommand(event.newCommand, event.revertCommands, event.applyCommands); }, newCommand: function newCommand(newCommand, revertCommands, applyCommands) { if (this.debug) console.log("-----"); // Revert all commands in revertCommands for (var i = 0; i < revertCommands.length; i++) { if (this.debug) console.log({'revert':revertCommands[i]}); // Get command object from stack, if it exists, otherwise unpack/deserialize it var commands = this.getCommandsFromStack(revertCommands[i]); if (typeof commands === "undefined") { commands = this.unpackToCommands(revertCommands[i]); } this.facade.rollbackCommands(commands); } // Apply all commands in applyCommands for (var i = 0; i < applyCommands.length; i++) { if (this.debug) console.log({'apply':applyCommands[i]}); // Get command object from stack, if it exists, otherwise unpack/deserialize it var unpackedCommands = this.unpackToCommands(applyCommands[i]); if (unpackedCommands.length !== 0) { this.facade.executeCommands(unpackedCommands); } } }, getCommandsFromStack: function getCommandsFromStack(stackItem) { //Try to get command object from stack, avoids unnecessary deserialisation var commandArrayOfStrings = stackItem.commands; var commandDataArray = []; for (var i = 0; i < commandArrayOfStrings.length; i++) { commandDataArray.push(commandArrayOfStrings[i].evalJSON()); } if (!commandDataArray[0].putOnStack) { return undefined; } var stack = ORYX.Stacks.undo; var ids = this.getIdsFromCommandArray(commandDataArray); for (i = 0; stack.length; i++) { for (var j = 0; j < ids.length; j++) { if (ids[j] === stack[i][0].getCommandId()) { return stack[i]; } } } return []; }, unpackToCommands: function unpackToCommands(stackItem) { // deserialize a command and create command object var commandArrayOfStrings = stackItem.commands; var commandArray = []; for (var i = 0; i < commandArrayOfStrings.length; i++) { var cmdObj = commandArrayOfStrings[i].evalJSON(); var commandInstance = ORYX.Core.Commands[cmdObj.name].prototype.jsonDeserialize(this.facade, commandArrayOfStrings[i]); if (typeof commandInstance === 'undefined') { return []; } commandArray.push(commandInstance); } return commandArray; }, /** Direction: Wave -> Oryx (New remote commands in Wave State) **/ handleAfterCommandsExecuted: function handleAfterCommandsExecuted(evt) { // All commands executed locally need to be pushed to wave state if (!evt.commands || !evt.commands[0].isLocal()) { return; } var serializedCommands = []; for (var i = 0; i < evt.commands.length; i++) { if (evt.commands[i] instanceof ORYX.Core.AbstractCommand) { //serialize commands serializedCommands.push(evt.commands[i].jsonSerialize()); } } // pass serialized commands to syncro this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE, 'commands': serializedCommands, 'forceExecution': true }); }, /** helper functions **/ getIdsFromCommandArray: function getIdsFromCommandArray(commandArray) { var commandIds = []; for (var i = 0; i < commandArray.length; i++) { commandIds.push(commandArray[i].id); } return commandIds; } });
08to09-processwave
oryx/editor/client/scripts/Plugins/syncroOryx.js
JavaScript
mit
6,474
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * This little script is used to enable debugging without the need to change oryx.js * * It is included in the test/examples/*.xhtml files as separate script * To enable inclusion in the WAR file, build-with-script-files-flag has to be used together with * build-with-xhtml-test-files-flag target */ // hack for Firebug 1.4.0a12, since console does not seem to be loaded automatically // this is causes no harm for Firebug 1.3.3 loadFirebugConsole(); // TODO only enable debugging, if firebug is really there // this doesn't work with Firebug 1.4.0a12 //if(typeof loadFirebugConsole == 'function') { ORYX_LOGLEVEL = ORYX_LOGLEVEL_DEBUG; //}
08to09-processwave
oryx/editor/client/scripts/debug.js
JavaScript
mit
2,142
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ // enable key-Events on form-fields Ext.override(Ext.form.Field, { fireKey : function(e) { if(((Ext.isIE && e.type == 'keydown') || e.type == 'keypress') && e.isSpecialKey()) { this.fireEvent('specialkey', this, e); } else { this.fireEvent(e.type, this, e); } } , initEvents : function() { // this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey, this); this.el.on("focus", this.onFocus, this); this.el.on("blur", this.onBlur, this); this.el.on("keydown", this.fireKey, this); this.el.on("keypress", this.fireKey, this); this.el.on("keyup", this.fireKey, this); // reference to original value for reset this.originalValue = this.getValue(); } });
08to09-processwave
oryx/editor/client/scripts/ext.js
JavaScript
mit
2,274
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if(!ORYX) var ORYX = {}; if(!ORYX.CONFIG) ORYX.CONFIG = {}; //This is usually the name of the war file! ORYX.CONFIG.ROOT_PATH = document.location.href.substring(0,document.location.href.lastIndexOf("/")) + "/../oryx/"; ORYX.CONFIG.WEB_URL = "http://oryx-project.org"; ORYX.CONFIG.COLLABORATION = true; ORYX.CONFIG.VERSION_URL = ORYX.CONFIG.ROOT_PATH + "VERSION"; ORYX.CONFIG.LICENSE_URL = ORYX.CONFIG.ROOT_PATH + "LICENSE"; ORYX.CONFIG.SERVER_HANDLER_ROOT = ""; ORYX.CONFIG.STENCILSET_HANDLER = ORYX.CONFIG.SERVER_HANDLER_ROOT + ""; /* Editor-Mode */ ORYX.CONFIG.MODE_READONLY = "readonly"; ORYX.CONFIG.MODE_FULLSCREEN = "fullscreen"; /* Show grid line while dragging */ ORYX.CONFIG.SHOW_GRIDLINE = true; ORYX.CONFIG.DISABLE_GRADIENT = true; /* Plugins */ ORYX.CONFIG.PLUGINS_ENABLED = true; ORYX.CONFIG.PLUGINS_CONFIG = ORYX.CONFIG.ROOT_PATH + "editor/client/scripts/Plugins/plugins.xml"; ORYX.CONFIG.PROFILE_PATH = ORYX.CONFIG.ROOT_PATH + "profiles/"; ORYX.CONFIG.PLUGINS_FOLDER = "Plugins/"; ORYX.CONFIG.PDF_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "pdf"; ORYX.CONFIG.PNML_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "pnml"; ORYX.CONFIG.SIMPLE_PNML_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "simplepnmlexporter"; ORYX.CONFIG.DESYNCHRONIZABILITY_URL = ORYX.CONFIG.ROOT_PATH + "desynchronizability"; ORYX.CONFIG.IBPMN2BPMN_URL = ORYX.CONFIG.ROOT_PATH + "ibpmn2bpmn"; ORYX.CONFIG.QUERYEVAL_URL = ORYX.CONFIG.ROOT_PATH + "query"; ORYX.CONFIG.SYNTAXCHECKER_URL = ORYX.CONFIG.ROOT_PATH + "syntaxchecker"; ORYX.CONFIG.VALIDATOR_URL = ORYX.CONFIG.ROOT_PATH + "validator"; ORYX.CONFIG.AUTO_LAYOUTER_URL = ORYX.CONFIG.ROOT_PATH + "layouter"; ORYX.CONFIG.SS_EXTENSIONS_FOLDER = ORYX.CONFIG.ROOT_PATH + "editor/data/stencilsets/extensions/"; ORYX.CONFIG.SS_EXTENSIONS_CONFIG = ORYX.CONFIG.ROOT_PATH + "editor/data/stencilsets/extensions/extensions.json"; ORYX.CONFIG.ORYX_NEW_URL = "/new"; ORYX.CONFIG.STEP_THROUGH = ORYX.CONFIG.ROOT_PATH + "stepthrough"; ORYX.CONFIG.STEP_THROUGH_CHECKER = ORYX.CONFIG.ROOT_PATH + "stepthroughchecker"; ORYX.CONFIG.XFORMS_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "xformsexport"; ORYX.CONFIG.XFORMS_EXPORT_ORBEON_URL = ORYX.CONFIG.ROOT_PATH + "xformsexport-orbeon"; ORYX.CONFIG.XFORMS_IMPORT_URL = ORYX.CONFIG.ROOT_PATH + "xformsimport"; ORYX.CONFIG.BPEL_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "bpelexporter"; ORYX.CONFIG.BPEL4CHOR_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "bpel4chorexporter"; ORYX.CONFIG.TREEGRAPH_SUPPORT = ORYX.CONFIG.ROOT_PATH + "treegraphsupport"; ORYX.CONFIG.XPDL4CHOR2BPEL4CHOR_TRANSFORMATION_URL = ORYX.CONFIG.ROOT_PATH + "xpdl4chor2bpel4chor"; ORYX.CONFIG.RESOURCE_LIST = ORYX.CONFIG.ROOT_PATH + "resourceList"; ORYX.CONFIG.BPMN_LAYOUTER = ORYX.CONFIG.ROOT_PATH + "bpmnlayouter"; ORYX.CONFIG.EPC_LAYOUTER = ORYX.CONFIG.ROOT_PATH + "epclayouter"; ORYX.CONFIG.BPMN2MIGRATION = ORYX.CONFIG.ROOT_PATH + "bpmn2migration"; ORYX.CONFIG.BPMN20_SCHEMA_VALIDATION_ON = true; /* Namespaces */ ORYX.CONFIG.NAMESPACE_ORYX = "http://www.b3mn.org/oryx"; ORYX.CONFIG.NAMESPACE_SVG = "http://www.w3.org/2000/svg"; /* UI */ ORYX.CONFIG.CANVAS_WIDTH = 1920; ORYX.CONFIG.CANVAS_HEIGHT = 550; ORYX.CONFIG.CANVAS_RESIZE_INTERVAL = 300; ORYX.CONFIG.SELECTED_AREA_PADDING = 4; ORYX.CONFIG.CANVAS_BACKGROUND_COLOR = "none"; ORYX.CONFIG.GRID_DISTANCE = 30; ORYX.CONFIG.GRID_ENABLED = true; ORYX.CONFIG.ZOOM_OFFSET = 0.1; ORYX.CONFIG.DEFAULT_SHAPE_MARGIN = 60; ORYX.CONFIG.SCALERS_SIZE = 7; ORYX.CONFIG.MINIMUM_SIZE = 20; ORYX.CONFIG.MAXIMUM_SIZE = 10000; ORYX.CONFIG.OFFSET_MAGNET = 15; ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP = 14; ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE = 4; ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM = 12; ORYX.CONFIG.OFFSET_EDGE_BOUNDS = 5; ORYX.CONFIG.COPY_MOVE_OFFSET = 30; ORYX.CONFIG.SHOW_GRIDLINE = true; ORYX.CONFIG.BORDER_OFFSET = 14; ORYX.CONFIG.MAX_NUM_SHAPES_NO_GROUP = 10; ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET_CORNER = 30; ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET = 45; /* Shape-Menu Align */ ORYX.CONFIG.SHAPEMENU_RIGHT = "Oryx_Right"; ORYX.CONFIG.SHAPEMENU_BOTTOM = "Oryx_Bottom"; ORYX.CONFIG.SHAPEMENU_LEFT = "Oryx_Left"; ORYX.CONFIG.SHAPEMENU_TOP = "Oryx_Top"; /* Morph-Menu Item */ ORYX.CONFIG.MORPHITEM_DISABLED = "Oryx_MorphItem_disabled"; /* Property type names */ ORYX.CONFIG.TYPE_STRING = "string"; ORYX.CONFIG.TYPE_BOOLEAN = "boolean"; ORYX.CONFIG.TYPE_INTEGER = "integer"; ORYX.CONFIG.TYPE_FLOAT = "float"; ORYX.CONFIG.TYPE_COLOR = "color"; ORYX.CONFIG.TYPE_DATE = "date"; ORYX.CONFIG.TYPE_CHOICE = "choice"; ORYX.CONFIG.TYPE_URL = "url"; ORYX.CONFIG.TYPE_DIAGRAM_LINK = "diagramlink"; ORYX.CONFIG.TYPE_COMPLEX = "complex"; ORYX.CONFIG.TYPE_TEXT = "text"; /* Vertical line distance of multiline labels */ ORYX.CONFIG.LABEL_LINE_DISTANCE = 2; ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT = 12; ORYX.CONFIG.ENABLE_MORPHMENU_BY_HOVER = true; /* Editor constants come here */ ORYX.CONFIG.EDITOR_ALIGN_BOTTOM = 0x01; ORYX.CONFIG.EDITOR_ALIGN_MIDDLE = 0x02; ORYX.CONFIG.EDITOR_ALIGN_TOP = 0x04; ORYX.CONFIG.EDITOR_ALIGN_LEFT = 0x08; ORYX.CONFIG.EDITOR_ALIGN_CENTER = 0x10; ORYX.CONFIG.EDITOR_ALIGN_RIGHT = 0x20; ORYX.CONFIG.EDITOR_ALIGN_SIZE = 0x30; ORYX.CONFIG.EVENT_MOUSEDOWN = "mousedown"; ORYX.CONFIG.EVENT_MOUSEUP = "mouseup"; ORYX.CONFIG.EVENT_MOUSEOVER = "mouseover"; ORYX.CONFIG.EVENT_MOUSEOUT = "mouseout"; ORYX.CONFIG.EVENT_MOUSEMOVE = "mousemove"; ORYX.CONFIG.EVENT_DBLCLICK = "dblclick"; ORYX.CONFIG.EVENT_KEYDOWN = "keydown"; ORYX.CONFIG.EVENT_KEYUP = "keyup"; ORYX.CONFIG.EVENT_LOADED = "editorloaded"; ORYX.CONFIG.EVENT_SHAPEBOUNDS_CHANGED = "shapeBoundsChanged"; ORYX.CONFIG.EVENT_EXECUTE_COMMANDS = "executeCommands"; ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED = "afterCommandsExecuted"; ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK = "afterCommandsRollback"; ORYX.CONFIG.EVENT_STENCIL_SET_LOADED = "stencilSetLoaded"; ORYX.CONFIG.EVENT_SELECTION_CHANGED = "selectionchanged"; ORYX.CONFIG.EVENT_SHAPEADDED = "shapeadded"; ORYX.CONFIG.EVENT_SHAPEDELETED = "shapedeleted"; ORYX.CONFIG.EVENT_SHAPESTODELETE = "shapesToDelete"; ORYX.CONFIG.EVENT_SHAPESTOUNDODELETE = "shapesToUndoDelete"; ORYX.CONFIG.EVENT_PROPERTY_CHANGED = "propertyChanged"; ORYX.CONFIG.EVENT_DRAGDROP_START = "dragdrop.start"; ORYX.CONFIG.EVENT_SHAPE_MENU_CLOSE = "shape.menu.close"; ORYX.CONFIG.EVENT_DRAGDROP_END = "dragdrop.end"; ORYX.CONFIG.EVENT_RESIZE_START = "resize.start"; ORYX.CONFIG.EVENT_RESIZE_END = "resize.end"; ORYX.CONFIG.EVENT_DRAGDOCKER_DOCKED = "dragDocker.docked"; ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW = "highlight.showHighlight"; ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE = "highlight.hideHighlight"; ORYX.CONFIG.EVENT_LOADING_ENABLE = "loading.enable"; ORYX.CONFIG.EVENT_LOADING_DISABLE = "loading.disable"; ORYX.CONFIG.EVENT_LOADING_STATUS = "loading.status"; ORYX.CONFIG.EVENT_OVERLAY_SHOW = "overlay.show"; ORYX.CONFIG.EVENT_OVERLAY_HIDE = "overlay.hide"; ORYX.CONFIG.EVENT_ARRANGEMENT_TOP = "arrangement.setToTop"; ORYX.CONFIG.EVENT_ARRANGEMENT_BACK = "arrangement.setToBack"; ORYX.CONFIG.EVENT_ARRANGEMENT_FORWARD = "arrangement.setForward"; ORYX.CONFIG.EVENT_ARRANGEMENT_BACKWARD = "arrangement.setBackward"; ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_TOP = "arrangementLight.setToTop"; ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED = "propertyWindow.propertyChanged"; ORYX.CONFIG.EVENT_LAYOUT_ROWS = "layout.rows"; ORYX.CONFIG.EVENT_LAYOUT_EDGES = "layout.edges"; ORYX.CONFIG.EVENT_LAYOUT_BPEL = "layout.BPEL"; ORYX.CONFIG.EVENT_LAYOUT_BPEL_VERTICAL = "layout.BPEL.vertical"; ORYX.CONFIG.EVENT_LAYOUT_BPEL_HORIZONTAL = "layout.BPEL.horizontal"; ORYX.CONFIG.EVENT_LAYOUT_BPEL_SINGLECHILD = "layout.BPEL.singlechild"; ORYX.CONFIG.EVENT_LAYOUT_BPEL_AUTORESIZE = "layout.BPEL.autoresize"; ORYX.CONFIG.EVENT_AUTOLAYOUT_LAYOUT = "autolayout.layout"; ORYX.CONFIG.EVENT_UNDO_EXECUTE = "undo.execute"; ORYX.CONFIG.EVENT_UNDO_ROLLBACK = "undo.rollback"; ORYX.CONFIG.EVENT_BUTTON_UPDATE = "toolbar.button.update"; ORYX.CONFIG.EVENT_LAYOUT = "layout.dolayout"; ORYX.CONFIG.EVENT_COLOR_CHANGE = "color.change"; ORYX.CONFIG.EVENT_NEW_POST_MESSAGE_RECEIVED = "newPostCommandReceived"; ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS = "farbrausch.new.infos"; ORYX.CONFIG.EVENT_USER_ID_CHANGED = "collaboration.userId"; ORYX.CONFIG.EVENT_VIEW_FIT_TO_MODEL = "view.fitToModel"; ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED = "shapeMetaDataChanged"; ORYX.CONFIG.EVENT_SIDEBAR_LOADED = "sideTabs.loaded"; ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB = "sideTabs.newTab"; ORYX.CONFIG.EVENT_POST_MESSAGE = "post.message"; ORYX.CONFIG.EVENT_SHOW_PROPERTYWINDOW = "propertywindow.show"; ORYX.CONFIG.EVENT_CANVAS_RESIZED = "canvasResize.resized"; ORYX.CONFIG.EVENT_CANVAS_RESIZE_SHAPES_MOVED = "canvasResize.shapesMoved"; ORYX.CONFIG.EVENT_CANVAS_RESIZE_UPDATE_HIGHLIGHTS = "canvasResize.updateHighlights"; ORYX.CONFIG.EVENT_LABEL_DBLCLICK = "label.dblclick"; ORYX.CONFIG.EVENT_CANVAS_DRAGDROP_LOCK_TOGGLE = "canvas.dragDropLockChanged"; ORYX.CONFIG.EVENT_SYNCRO_INITIALIZATION_DONE = "syncro.initializationDone"; ORYX.CONFIG.EVENT_COMMAND_ADDED_TO_UNDO_STACK = "changelog.command_added"; ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_UNDO_STACK = "changelog.command_moved_from_undo"; ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_REDO_STACK = "changelog.command_moved_from_redo"; ORYX.CONFIG.EVENT_DOCKERDRAG = "dragTheDocker"; ORYX.CONFIG.EVENT_PAINT_NEWSHAPE = "paint.newShape"; ORYX.CONFIG.EVENT_PAINT_REMOVESHAPE = "paint.removeShape"; ORYX.CONFIG.EVENT_PAINT_CANVAS_TOGGLED = "paint.toggled"; ORYX.CONFIG.EVENT_BLIP_TOGGLED = "blip.toggled"; ORYX.CONFIG.EVENT_MODE_CHANGED = "mode.change"; ORYX.CONFIG.EVENT_CANVAS_ZOOMED = "canvas.zoomed"; ORYX.CONFIG.EVENT_DISPLAY_SCHLAUMEIER = "schlaumeier.display"; ORYX.CONFIG.EVENT_HIDE_SCHLAUMEIER = "schlaumeier.hide"; ORYX.CONFIG.EVENT_ORYX_SHOWN = "oryx.shown"; ORYX.CONFIG.EVENT_DISABLE_DOCKER_CREATION = "addDocker.disableCreation"; ORYX.CONFIG.EVENT_ENABLE_DOCKER_CREATION = "addDocker.enableCreation"; ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE = "syncro.newCommandsForRemoteState" ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS = "syncro.newRemoteCommands" ORYX.CONFIG.FARBRAUSCH_DEFAULT_COLOR = "#000000"; /* Selection Shapes Highlights */ ORYX.CONFIG.SELECTION_HIGHLIGHT_SIZE = 5; ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR = "#4444FF"; ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR2 = "#9999FF"; ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_CORNER = "corner"; ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_RECTANGLE = "rectangle"; ORYX.CONFIG.SELECTION_VALID_COLOR = "#00FF00"; ORYX.CONFIG.SELECTION_INVALID_COLOR = "#FF0000"; ORYX.CONFIG.DOCKER_DOCKED_COLOR = "#00FF00"; ORYX.CONFIG.DOCKER_UNDOCKED_COLOR = "#FF0000"; ORYX.CONFIG.DOCKER_SNAP_OFFSET = 10; /* Copy & Paste */ ORYX.CONFIG.EDIT_OFFSET_PASTE = 10; /* Key-Codes */ ORYX.CONFIG.KEY_CODE_X = 88; ORYX.CONFIG.KEY_CODE_C = 67; ORYX.CONFIG.KEY_CODE_V = 86; ORYX.CONFIG.KEY_CODE_DELETE = 46; ORYX.CONFIG.KEY_CODE_META = 224; ORYX.CONFIG.KEY_CODE_BACKSPACE = 8; ORYX.CONFIG.KEY_CODE_LEFT = 37; ORYX.CONFIG.KEY_CODE_RIGHT = 39; ORYX.CONFIG.KEY_CODE_UP = 38; ORYX.CONFIG.KEY_CODE_DOWN = 40; // TODO Determine where the lowercase constants are still used and remove them from here. ORYX.CONFIG.KEY_Code_enter = 12; ORYX.CONFIG.KEY_Code_left = 37; ORYX.CONFIG.KEY_Code_right = 39; ORYX.CONFIG.KEY_Code_top = 38; ORYX.CONFIG.KEY_Code_bottom = 40; /* Supported Meta Keys */ ORYX.CONFIG.META_KEY_META_CTRL = "metactrl"; ORYX.CONFIG.META_KEY_ALT = "alt"; ORYX.CONFIG.META_KEY_SHIFT = "shift"; /* Key Actions */ ORYX.CONFIG.KEY_ACTION_DOWN = "down"; ORYX.CONFIG.KEY_ACTION_UP = "up";
08to09-processwave
oryx/editor/client/scripts/config.js
JavaScript
mit
13,673
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ function printf() { var result = arguments[0]; for (var i=1; i<arguments.length; i++) result = result.replace('%' + (i-1), arguments[i]); return result; } // oryx constants. var ORYX_LOGLEVEL_TRACE = 5; var ORYX_LOGLEVEL_DEBUG = 4; var ORYX_LOGLEVEL_INFO = 3; var ORYX_LOGLEVEL_WARN = 2; var ORYX_LOGLEVEL_ERROR = 1; var ORYX_LOGLEVEL_FATAL = 0; var ORYX_LOGLEVEL = ORYX_LOGLEVEL_WARN; var ORYX_CONFIGURATION_DELAY = 100; var ORYX_CONFIGURATION_WAIT_ATTEMPTS = 10; if(!ORYX) var ORYX = {}; ORYX = Object.extend(ORYX, { //set the path in the config.js file!!!! PATH: ORYX.CONFIG.ROOT_PATH, //CONFIGURATION: "config.js", URLS: [ /* * No longer needed, since compiled into one source file that * contains all of this files concatenated in the exact order * as defined in build.xml. */ /* "scripts/Core/SVG/editpathhandler.js", "scripts/Core/SVG/minmaxpathhandler.js", "scripts/Core/SVG/pointspathhandler.js", "scripts/Core/SVG/svgmarker.js", "scripts/Core/SVG/svgshape.js", "scripts/Core/SVG/label.js", "scripts/Core/Math/math.js", "scripts/Core/StencilSet/stencil.js", "scripts/Core/StencilSet/property.js", "scripts/Core/StencilSet/propertyitem.js", "scripts/Core/StencilSet/rules.js", "scripts/Core/StencilSet/stencilset.js", "scripts/Core/StencilSet/stencilsets.js", "scripts/Core/bounds.js", "scripts/Core/uiobject.js", "scripts/Core/abstractshape.js", "scripts/Core/canvas.js", "scripts/Core/main.js", "scripts/Core/svgDrag.js", "scripts/Core/shape.js", "scripts/Core/Controls/control.js", "scripts/Core/Controls/docker.js", "scripts/Core/Controls/magnet.js", "scripts/Core/node.js", "scripts/Core/edge.js" */ ], alreadyLoaded: [], configrationRetries: 0, Version: '0.1.1', availablePlugins: [], /** * The ORYX.Log logger. */ Log: { __appenders: [ { append: function(message) { console.log(message); }} ], trace: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_TRACE) ORYX.Log.__log('TRACE', arguments); }, debug: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_DEBUG) ORYX.Log.__log('DEBUG', arguments); }, info: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_INFO) ORYX.Log.__log('INFO', arguments); }, warn: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_WARN) ORYX.Log.__log('WARN', arguments); }, error: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_ERROR) ORYX.Log.__log('ERROR', arguments); }, fatal: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_FATAL) ORYX.Log.__log('FATAL', arguments); }, __log: function(prefix, messageParts) { messageParts[0] = (new Date()).getTime() + " " + prefix + " " + messageParts[0]; var message = printf.apply(null, messageParts); ORYX.Log.__appenders.each(function(appender) { appender.append(message); }); }, addAppender: function(appender) { ORYX.Log.__appenders.push(appender); } }, /** * First bootstrapping layer. The Oryx loading procedure begins. In this * step, all preliminaries that are not in the responsibility of Oryx to be * met have to be checked here, such as the existance of the prototpe * library in the current execution environment. After that, the second * bootstrapping layer is being invoked. Failing to ensure that any * preliminary condition is not met has to fail with an error. */ load: function() { ORYX.Log.debug("Oryx begins loading procedure."); // check for prototype if( (typeof Prototype=='undefined') || (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1]) < 1.5) throw("Application requires the Prototype JavaScript framework >= 1.5.3"); ORYX.Log.debug("Prototype > 1.5 found."); // continue loading. ORYX._load(); }, /** * Second bootstrapping layer. The oryx configuration is checked. When not * yet loaded, config.js is being requested from the server. A repeated * error in retrieving the configuration will result in an error to be * thrown after a certain time of retries. Once the configuration is there, * all urls that are registered with oryx loading are being requested from * the server. Once everything is loaded, the third layer is being invoked. */ _load: function() { /* // if configuration not there already, if(!(ORYX.CONFIG)) { // if this is the first attempt... if(ORYX.configrationRetries == 0) { // get the path and filename. var configuration = ORYX.PATH + ORYX.CONFIGURATION; ORYX.Log.debug("Configuration not found, loading from '%0'.", configuration); // require configuration file. Kickstart.require(configuration); // else if attempts exceeded ... } else if(ORYX.configrationRetries >= ORYX_CONFIGURATION_WAIT_ATTEMPTS) { throw "Tried to get configuration" + ORYX_CONFIGURATION_WAIT_ATTEMPTS + " times from '" + configuration + "'. Giving up." } else if(ORYX.configrationRetries > 0){ // point out how many attempts are left... ORYX.Log.debug("Waiting once more (%0 attempts left)", (ORYX_CONFIGURATION_WAIT_ATTEMPTS - ORYX.configrationRetries)); } // any case: continue in a moment with increased retry count. ORYX.configrationRetries++; window.setTimeout(ORYX._load, ORYX_CONFIGURATION_DELAY); return; } ORYX.Log.info("Configuration loaded."); // load necessary scripts. ORYX.URLS.each(function(url) { ORYX.Log.debug("Requireing '%0'", url); Kickstart.require(ORYX.PATH + url) }); */ // configurate logging and load plugins. ORYX.loadPlugins(); }, /** * Third bootstrapping layer. This is where first the plugin coniguration * file is loaded into oryx, analyzed, and where all plugins are being * requested by the server. Afterwards, all editor instances will be * initialized. */ loadPlugins: function() { // load plugins if enabled. if(ORYX.CONFIG.PLUGINS_ENABLED) ORYX._loadPlugins() else ORYX.Log.warn("Ignoring plugins, loading Core only."); // init the editor instances. init(); }, _loadPlugins: function() { // load plugin configuration file. var source = ORYX.CONFIG.PLUGINS_CONFIG; ORYX.Log.debug("Loading plugin configuration from '%0'.", source); new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: function(result) { /* * This is the method that is being called when the plugin * configuration was successfully loaded from the server. The * file has to be processed and the contents need to be * considered for further plugin requireation. */ ORYX.Log.info("Plugin configuration file loaded."); // get plugins.xml content var resultXml = result.responseXML; // TODO: Describe how properties are handled. // Get the globale Properties var globalProperties = []; var preferences = $A(resultXml.getElementsByTagName("properties")); preferences.each( function(p) { var props = $A(p.childNodes); props.each( function(prop) { var property = new Hash(); // get all attributes from the node and set to global properties var attributes = $A(prop.attributes) attributes.each(function(attr){property[attr.nodeName] = attr.nodeValue}); if(attributes.length > 0) { globalProperties.push(property) }; }); }); // TODO Why are we using XML if we don't respect structure anyway? // for each plugin element in the configuration.. var plugin = resultXml.getElementsByTagName("plugin"); $A(plugin).each( function(node) { // get all element's attributes. // TODO: What about: var pluginData = $H(node.attributes) !? var pluginData = new Hash(); $A(node.attributes).each( function(attr){ pluginData[attr.nodeName] = attr.nodeValue}); // ensure there's a name attribute. if(!pluginData['name']) { ORYX.Log.error("A plugin is not providing a name. Ingnoring this plugin."); return; } // ensure there's a source attribute. if(!pluginData['source']) { ORYX.Log.error("Plugin with name '%0' doesn't provide a source attribute.", pluginData['name']); return; } // Get all private Properties var propertyNodes = node.getElementsByTagName("property"); var properties = []; $A(propertyNodes).each(function(prop) { var property = new Hash(); // Get all Attributes from the Node var attributes = $A(prop.attributes) attributes.each(function(attr){property[attr.nodeName] = attr.nodeValue}); if(attributes.length > 0) { properties.push(property) }; }); // Set all Global-Properties to the Properties properties = properties.concat(globalProperties); // Set Properties to Plugin-Data pluginData['properties'] = properties; // Get the RequieredNodes var requireNodes = node.getElementsByTagName("requires"); var requires; $A(requireNodes).each(function(req) { var namespace = $A(req.attributes).find(function(attr){ return attr.name == "namespace"}) if( namespace && namespace.nodeValue ){ if( !requires ){ requires = {namespaces:[]} } requires.namespaces.push(namespace.nodeValue) } }); // Set Requires to the Plugin-Data, if there is one if( requires ){ pluginData['requires'] = requires; } // Get the RequieredNodes var notUsesInNodes = node.getElementsByTagName("notUsesIn"); var notUsesIn; $A(notUsesInNodes).each(function(not) { var namespace = $A(not.attributes).find(function(attr){ return attr.name == "namespace"}) if( namespace && namespace.nodeValue ){ if( !notUsesIn ){ notUsesIn = {namespaces:[]} } notUsesIn.namespaces.push(namespace.nodeValue) } }); // Set Requires to the Plugin-Data, if there is one if( notUsesIn ){ pluginData['notUsesIn'] = notUsesIn; } var url = ORYX.PATH + ORYX.CONFIG.PLUGINS_FOLDER + pluginData['source']; ORYX.Log.debug("Requireing '%0'", url); // Add the Script-Tag to the Site //Kickstart.require(url); ORYX.Log.info("Plugin '%0' successfully loaded.", pluginData['name']); // Add the Plugin-Data to all available Plugins ORYX.availablePlugins.push(pluginData); }); }, onFailure:this._loadPluginsOnFails }); }, _loadPluginsOnFails: function(result) { ORYX.Log.error("Plugin configuration file not available."); } }); ORYX.Log.debug('Registering Oryx with Kickstart'); Kickstart.register(ORYX.load);
08to09-processwave
oryx/editor/client/scripts/oryx.js
JavaScript
mit
12,685
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ NAMESPACE_SVG = "http://www.w3.org/2000/svg"; NAMESPACE_ORYX = "http://www.b3mn.org/oryx"; /** * Init namespaces */ if (!ORYX) { var ORYX = {}; } if (!ORYX.Core) { ORYX.Core = {}; } /** * @classDescription Abstract base class for all connections. * @extends {ORYX.Core.Shape} * @param options {Object} * * TODO da die verschiebung der Edge nicht ueber eine * translation gemacht wird, die sich auch auf alle kind UIObjects auswirkt, * muessen die kinder hier beim verschieben speziell betrachtet werden. * Das sollte ueberarbeitet werden. * */ ORYX.Core.Edge = { /** * Constructor * @param {Object} options * @param {Stencil} stencil */ construct: function(options, stencil){ arguments.callee.$.construct.apply(this, arguments); this.isMovable = true; this.isSelectable = true; this._dockerUpdated = false; this._markers = new Hash(); //a hash map of SVGMarker objects where keys are the marker ids this._paths = []; this._interactionPaths = []; this._dockersByPath = new Hash(); this._markersByPath = new Hash(); /* Data structures to store positioning information of attached child nodes */ this.attachedNodePositionData = new Hash(); //TODO was muss hier initial erzeugt werden? var stencilNode = this.node.childNodes[0].childNodes[0]; stencilNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", stencilNode, ['g', { "pointer-events": "painted" }]); //Add to the EventHandler this.addEventHandlers(stencilNode); this._oldBounds = this.bounds.clone(); //load stencil this._init(this._stencil.view()); if (stencil instanceof Array) { this.deserialize(stencil); } }, _update: function(force){ if(this._dockerUpdated || this.isChanged || force) { this.dockers.invoke("update"); if (this.bounds.width() === 0 || this.bounds.height() === 0) { this.bounds.moveBy({ x: this.bounds.width() === 0 ? -1 : 0, y: this.bounds.height() === 0 ? -1 : 0 }); this.bounds.extend({ x: this.bounds.width() === 0 ? 2 : 0, y: this.bounds.height() === 0 ? 2 : 0 }); } // TODO: Bounds muss abhaengig des Eltern-Shapes gesetzt werden var upL = this.bounds.upperLeft(); var oldUpL = this._oldBounds.upperLeft(); var oldWidth = this._oldBounds.width() === 0 ? this.bounds.width() : this._oldBounds.width(); var oldHeight = this._oldBounds.height() === 0 ? this.bounds.height() : this._oldBounds.height(); var diffX = upL.x - oldUpL.x; var diffY = upL.y - oldUpL.y; var diffWidth = this.bounds.width() / oldWidth; var diffHeight = this.bounds.height() / oldHeight; this.dockers.each((function(docker){ // Unregister on BoundsChangedCallback docker.bounds.unregisterCallback(this._dockerChangedCallback); // If there is any changes at the edge and is there is not an DockersUpdate // set the new bounds to the docker if (!this._dockerUpdated) { docker.bounds.moveBy(diffX, diffY); if (diffWidth !== 1 || diffHeight !== 1) { var relX = docker.bounds.upperLeft().x - upL.x; var relY = docker.bounds.upperLeft().y - upL.y; docker.bounds.moveTo(upL.x + relX * diffWidth, upL.y + relY * diffHeight); } } // Do Docker update and register on DockersBoundChange docker.update(); docker.bounds.registerCallback(this._dockerChangedCallback); }).bind(this)); if (this._dockerUpdated) { var a = this.dockers.first().bounds.center(); var b = this.dockers.first().bounds.center(); this.dockers.each((function(docker){ var center = docker.bounds.center(); a.x = Math.min(a.x, center.x); a.y = Math.min(a.y, center.y); b.x = Math.max(b.x, center.x); b.y = Math.max(b.y, center.y); }).bind(this)); //set the bounds of the the association this.bounds.set(Object.clone(a), Object.clone(b)); } //reposition labels this.getLabels().each(function(label) { switch (label.edgePosition) { case "starttop": var angle = this._getAngle(this.dockers[0], this.dockers[1]); var pos = this.dockers.first().bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("left"); label.verticalAlign("bottom"); label.x = pos.x + label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("right"); label.verticalAlign("bottom"); label.x = pos.x - label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(180 - angle, pos); } break; case "startmiddle": var angle = this._getAngle(this.dockers[0], this.dockers[1]); var pos = this.dockers.first().bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("left"); label.verticalAlign("bottom"); label.x = pos.x + 1; label.y = pos.y + ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE; label.rotate(360 - angle, pos); } else { label.horizontalAlign("right"); label.verticalAlign("bottom"); label.x = pos.x + 1; label.y = pos.y + ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE; label.rotate(180 - angle, pos); } break; case "startbottom": var angle = this._getAngle(this.dockers[0], this.dockers[1]); var pos = this.dockers.first().bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("left"); label.verticalAlign("top"); label.x = pos.x + label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("right"); label.verticalAlign("top"); label.x = pos.x - label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(180 - angle, pos); } break; case "midtop": var numOfDockers = this.dockers.length; if(numOfDockers%2 == 0) { var angle = this._getAngle(this.dockers[numOfDockers/2-1], this.dockers[numOfDockers/2]) var pos1 = this.dockers[numOfDockers/2-1].bounds.center(); var pos2 = this.dockers[numOfDockers/2].bounds.center(); var pos = {x:(pos1.x + pos2.x)/2.0, y:(pos1.y+pos2.y)/2.0}; label.horizontalAlign("center"); label.verticalAlign("bottom"); label.x = pos.x; label.y = pos.y - label.getOffsetTop(); if (angle <= 90 || angle > 270) { label.rotate(360 - angle, pos); } else { label.rotate(180 - angle, pos); } } else { var index = parseInt(numOfDockers/2); var angle = this._getAngle(this.dockers[index], this.dockers[index+1]) var pos = this.dockers[index].bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("left"); label.verticalAlign("bottom"); label.x = pos.x + label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("right"); label.verticalAlign("bottom"); label.x = pos.x - label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(180 - angle, pos); } } break; case "midbottom": var numOfDockers = this.dockers.length; if(numOfDockers%2 == 0) { var angle = this._getAngle(this.dockers[numOfDockers/2-1], this.dockers[numOfDockers/2]) var pos1 = this.dockers[numOfDockers/2-1].bounds.center(); var pos2 = this.dockers[numOfDockers/2].bounds.center(); var pos = {x:(pos1.x + pos2.x)/2.0, y:(pos1.y+pos2.y)/2.0}; label.horizontalAlign("center"); label.verticalAlign("top"); label.x = pos.x; label.y = pos.y + label.getOffsetTop(); if (angle <= 90 || angle > 270) { label.rotate(360 - angle, pos); } else { label.rotate(180 - angle, pos); } } else { var index = parseInt(numOfDockers/2); var angle = this._getAngle(this.dockers[index], this.dockers[index+1]) var pos = this.dockers[index].bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("left"); label.verticalAlign("top"); label.x = pos.x + label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("right"); label.verticalAlign("top"); label.x = pos.x - label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(180 - angle, pos); } } break; case "endtop": var length = this.dockers.length; var angle = this._getAngle(this.dockers[length-2], this.dockers[length-1]); var pos = this.dockers.last().bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("right"); label.verticalAlign("bottom"); label.x = pos.x - label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("left"); label.verticalAlign("bottom"); label.x = pos.x + label.getOffsetTop(); label.y = pos.y - label.getOffsetTop(); label.rotate(180 - angle, pos); } break; case "endbottom": var length = this.dockers.length; var angle = this._getAngle(this.dockers[length-2], this.dockers[length-1]); var pos = this.dockers.last().bounds.center(); if (angle <= 90 || angle > 270) { label.horizontalAlign("right"); label.verticalAlign("top"); label.x = pos.x - label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(360 - angle, pos); } else { label.horizontalAlign("left"); label.verticalAlign("top"); label.x = pos.x + label.getOffsetBottom(); label.y = pos.y + label.getOffsetBottom(); label.rotate(180 - angle, pos); } break; } }.bind(this)); this.children.each(function(value) { if(value instanceof ORYX.Core.Node) { this.calculatePositionOfAttachedChildNode.call(this, value); } }.bind(this)); this.refreshAttachedNodes(); this.refresh(); this.isChanged = false; this._dockerUpdated = false; this._oldBounds = this.bounds.clone(); } }, /** * Moves a point to the upperLeft of a node's bounds. * * @param {point} point * The point to move * @param {ORYX.Core.Bounds} bounds * The Bounds of the related noe */ movePointToUpperLeftOfNode: function(point, bounds) { point.x -= bounds.width()/2; point.y -= bounds.height()/2; }, /** * Refreshes the visual representation of edge's attached nodes. */ refreshAttachedNodes: function() { this.attachedNodePositionData.values().each(function(nodeData) { var startPoint = nodeData.segment.docker1.bounds.center(); var endPoint = nodeData.segment.docker2.bounds.center(); this.relativizePoint(startPoint); this.relativizePoint(endPoint); var newNodePosition = new Object(); /* Calculate new x-coordinate */ newNodePosition.x = startPoint.x + nodeData.relativDistanceFromDocker1 * (endPoint.x - startPoint.x); /* Calculate new y-coordinate */ newNodePosition.y = startPoint.y + nodeData.relativDistanceFromDocker1 * (endPoint.y - startPoint.y); /* Convert new position to the upper left of the node */ this.movePointToUpperLeftOfNode(newNodePosition, nodeData.node.bounds); /* Move node to its new position */ nodeData.node.bounds.moveTo(newNodePosition); nodeData.node._update(); }.bind(this)); }, /** * Calculates the position of an edge's child node. The node is placed on * the path of the edge. * * @param {node} * The node to calculate the new position * @return {Point} * The calculated upper left point of the node's shape. */ calculatePositionOfAttachedChildNode: function(node) { /* Initialize position */ var position = new Object(); position.x = 0; position.y = 0; /* Case: Node was just added */ if(!this.attachedNodePositionData[node.getId()]) { this.attachedNodePositionData[node.getId()] = new Object(); this.attachedNodePositionData[node.getId()] .relativDistanceFromDocker1 = 0; this.attachedNodePositionData[node.getId()].node = node; this.attachedNodePositionData[node.getId()].segment = new Object(); this.findEdgeSegmentForNode(node); }else if(node.isChanged) { this.findEdgeSegmentForNode(node); } }, /** * Finds the appropriate edge segement for a node. * The segment is choosen, which has the smallest distance to the node. * * @param {ORYX.Core.Node} node * The concerning node */ findEdgeSegmentForNode: function(node) { var length = this.dockers.length; var smallestDistance = undefined; for(i=1;i<length;i++) { var lineP1 = this.dockers[i-1].bounds.center(); var lineP2 = this.dockers[i].bounds.center(); this.relativizePoint(lineP1); this.relativizePoint(lineP2); var nodeCenterPoint = node.bounds.center(); var distance = ORYX.Core.Math.distancePointLinie( lineP1, lineP2, nodeCenterPoint, true); if((distance || distance == 0) && ((!smallestDistance && smallestDistance != 0) || distance < smallestDistance)) { smallestDistance = distance; this.attachedNodePositionData[node.getId()].segment.docker1 = this.dockers[i-1]; this.attachedNodePositionData[node.getId()].segment.docker2 = this.dockers[i]; } /* Either the distance does not match the segment or the distance * between docker1 and docker2 is 0 * * In this case choose the nearest docker as attaching point. * */ if(!distance && !smallestDistance && smallestDistance != 0) { (ORYX.Core.Math.getDistancePointToPoint(nodeCenterPoint, lineP1) < ORYX.Core.Math.getDistancePointToPoint(nodeCenterPoint, lineP2)) ? this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 = 0 : this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 = 1; this.attachedNodePositionData[node.getId()].segment.docker1 = this.dockers[i-1]; this.attachedNodePositionData[node.getId()].segment.docker2 = this.dockers[i]; } } /* Calculate position on edge segment for the node */ if(smallestDistance || smallestDistance == 0) { this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 = this.getLineParameterForPosition( this.attachedNodePositionData[node.getId()].segment.docker1, this.attachedNodePositionData[node.getId()].segment.docker2, node); } }, /** * Returns the value of the scalar to determine the position of the node on * line defined by docker1 and docker2. * * @param {point} docker1 * The docker that defines the start of the line segment * @param {point} docker2 * The docker that defines the end of the line segment * @param {ORYX.Core.Node} node * The concerning node * * @return {float} positionParameter * The scalar value to determine the position on the line */ getLineParameterForPosition: function(docker1, docker2, node) { var dockerPoint1 = docker1.bounds.center(); var dockerPoint2 = docker2.bounds.center(); this.relativizePoint(dockerPoint1); this.relativizePoint(dockerPoint2); var intersectionPoint = ORYX.Core.Math.getPointOfIntersectionPointLine( dockerPoint1, dockerPoint2, node.bounds.center(), true); if(!intersectionPoint) { return 0; } var relativeDistance = ORYX.Core.Math.getDistancePointToPoint(intersectionPoint, dockerPoint1) / ORYX.Core.Math.getDistancePointToPoint(dockerPoint1, dockerPoint2); return relativeDistance; }, /** * Makes point relative to the upper left of the edge's bound. * * @param {point} point * The point to relativize */ relativizePoint: function(point) { point.x -= this.bounds.upperLeft().x; point.y -= this.bounds.upperLeft().y; }, refresh: function(){ //call base class refresh method arguments.callee.$.refresh.apply(this, arguments); //TODO consider points for marker mids var lastPoint; this._paths.each((function(path, index){ var dockers = this._dockersByPath[path.id]; var c = undefined; var d = undefined; if (lastPoint) { d = "M" + lastPoint.x + " " + lastPoint.y; } else { c = dockers[0].bounds.center(); lastPoint = c; d = "M" + c.x + " " + c.y; } for (var i = 1; i < dockers.length; i++) { // for each docker, draw a line to the center c = dockers[i].bounds.center(); d = d + "L" + c.x + " " + c.y + " "; lastPoint = c; } path.setAttributeNS(null, "d", d); this._interactionPaths[index].setAttributeNS(null, "d", d); }).bind(this)); /* move child shapes of an edge */ if(this.getChildNodes().length > 0) { var x = this.bounds.upperLeft().x; var y = this.bounds.upperLeft().y; this.node.firstChild.childNodes[1].setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")"); } }, /** * Calculate the Border Intersection Point between two points * @param {PointA} * @param {PointB} */ getIntersectionPoint: function(){ var length = Math.floor(this.dockers.length / 2) return ORYX.Core.Math.midPoint(this.dockers[length - 1].bounds.center(), this.dockers[length].bounds.center()) }, /** * Calculate if the point is inside the Shape * @param {PointX} * @param {PointY} */ isPointIncluded: function(pointX, pointY){ var isbetweenAB = this.absoluteBounds().isIncluded(pointX, pointY, ORYX.CONFIG.OFFSET_EDGE_BOUNDS); var isPointIncluded = undefined; if (isbetweenAB && this.dockers.length > 0) { var i = 0; var point1, point2; do { point1 = this.dockers[i].bounds.center(); point2 = this.dockers[++i].bounds.center(); isPointIncluded = ORYX.Core.Math.isPointInLine(pointX, pointY, point1.x, point1.y, point2.x, point2.y, ORYX.CONFIG.OFFSET_EDGE_BOUNDS); } while (!isPointIncluded && i < this.dockers.length - 1) } return isPointIncluded; }, /** * Calculate if the point is over an special offset area * @param {Point} */ isPointOverOffset: function(){ return false }, /** * Returns the angle of the line between two dockers * (0 - 359.99999999) */ _getAngle: function(docker1, docker2) { var p1 = docker1.absoluteCenterXY(); var p2 = docker2.absoluteCenterXY(); if(p1.x == p2.x && p1.y == p2.y) return 0; var angle = Math.asin(Math.sqrt(Math.pow(p1.y-p2.y, 2)) /(Math.sqrt(Math.pow(p2.x-p1.x, 2)+Math.pow(p1.y-p2.y, 2)))) *180/Math.PI; if(p2.x >= p1.x && p2.y <= p1.y) return angle; else if(p2.x < p1.x && p2.y <= p1.y) return 180 - angle; else if(p2.x < p1.x && p2.y > p1.y) return 180 + angle; else return 360 - angle; }, alignDockers: function(){ this._update(true); var firstPoint = this.dockers.first().bounds.center(); var lastPoint = this.dockers.last().bounds.center(); var deltaX = lastPoint.x - firstPoint.x; var deltaY = lastPoint.y - firstPoint.y; var numOfDockers = this.dockers.length - 1; this.dockers.each((function(docker, index){ var part = index / numOfDockers; docker.bounds.unregisterCallback(this._dockerChangedCallback); docker.bounds.moveTo(firstPoint.x + part * deltaX, firstPoint.y + part * deltaY); docker.bounds.registerCallback(this._dockerChangedCallback); }).bind(this)); this._dockerChanged(); }, add: function(shape){ arguments.callee.$.add.apply(this, arguments); // If the new shape is a Docker which is not contained if (shape instanceof ORYX.Core.Controls.Docker && this.dockers.include(shape)){ // Add it to the dockers list ordered by paths var pathArray = this._dockersByPath.values()[0]; if (pathArray) { pathArray.splice(this.dockers.indexOf(shape), 0, shape); } /* Perform nessary adjustments on the edge's child shapes */ this.handleChildShapesAfterAddDocker(shape); } }, /** * Performs nessary adjustments on the edge's child shapes. * * @param {ORYX.Core.Controls.Docker} docker * The added docker */ handleChildShapesAfterAddDocker: function(docker) { /* Ensure type of Docker */ if(!docker instanceof ORYX.Core.Controls.Docker) {return undefined;} var index = this.dockers.indexOf(docker); if(!(0 < index && index < this.dockers.length - 1)) { /* Exception: Expect added docker between first and last node of the edge */ return undefined; } /* Get child nodes concerning the segment of the new docker */ var startDocker = this.dockers[index-1]; var endDocker = this.dockers[index+1]; /* Adjust the position of edge's child nodes */ var segmentElements = this.getAttachedNodePositionDataForSegment(startDocker, endDocker); var lengthSegmentPart1 = ORYX.Core.Math.getDistancePointToPoint( startDocker.bounds.center(), docker.bounds.center()); var lengthSegmentPart2 = ORYX.Core.Math.getDistancePointToPoint( endDocker.bounds.center(), docker.bounds.center()); if(!(lengthSegmentPart1 + lengthSegmentPart2)) {return;} var relativDockerPosition = lengthSegmentPart1 / (lengthSegmentPart1 + lengthSegmentPart2); segmentElements.each(function(nodePositionData) { /* Assign child node to the new segment */ if(nodePositionData.value.relativDistanceFromDocker1 < relativDockerPosition) { /* Case: before added Docker */ nodePositionData.value.segment.docker2 = docker; nodePositionData.value.relativDistanceFromDocker1 = nodePositionData.value.relativDistanceFromDocker1 / relativDockerPosition; } else { /* Case: after added Docker */ nodePositionData.value.segment.docker1 = docker; var newFullDistance = 1 - relativDockerPosition; var relativPartOfSegment = nodePositionData.value.relativDistanceFromDocker1 - relativDockerPosition; nodePositionData.value.relativDistanceFromDocker1 = relativPartOfSegment / newFullDistance; } }) /* Update attached nodes visual representation */ this.refreshAttachedNodes(); }, /** * Returns elements from {@link attachedNodePositiondata} that match the * segement defined by startDocker and endDocker. * * @param {ORYX.Core.Controls.Docker} startDocker * The docker defining the begin of the segment. * @param {ORYX.Core.Controls.Docker} endDocker * The docker defining the begin of the segment. * * @return {Hash} attachedNodePositionData * Child elements matching the segment */ getAttachedNodePositionDataForSegment: function(startDocker, endDocker) { /* Ensure that the segment is defined correctly */ if(!((startDocker instanceof ORYX.Core.Controls.Docker) && (endDocker instanceof ORYX.Core.Controls.Docker))) { return []; } /* Get elements of the segment */ var elementsOfSegment = this.attachedNodePositionData.findAll(function(nodePositionData) { return nodePositionData.value.segment.docker1 === startDocker && nodePositionData.value.segment.docker2 === endDocker; }); /* Return a Hash in each case */ if(!elementsOfSegment) {return [];} return elementsOfSegment; }, /** * Removes an edge's child shape */ remove: function(shape) { arguments.callee.$.remove.apply(this, arguments); if(this.attachedNodePositionData[shape.getId()]) { delete this.attachedNodePositionData[shape.getId()]; } /* Adjust child shapes if neccessary */ if(shape instanceof ORYX.Core.Controls.Docker) { this.handleChildShapesAfterRemoveDocker(shape); } }, /** * Adjusts the child shapes of an edges after a docker was removed. * * @param{ORYX.Core.Controls.Docker} docker * The removed docker. */ handleChildShapesAfterRemoveDocker: function(docker) { /* Ensure docker type */ if(!(docker instanceof ORYX.Core.Controls.Docker)) {return;} this.attachedNodePositionData.each(function(nodePositionData) { if(nodePositionData.value.segment.docker1 === docker) { /* The new start of the segment is the predecessor of docker2. */ var index = this.dockers.indexOf(nodePositionData.value.segment.docker2); if(index == -1) {return;} nodePositionData.value.segment.docker1 = this.dockers[index - 1]; } else if(nodePositionData.value.segment.docker2 === docker) { /* The new end of the segment is the successor of docker1. */ var index = this.dockers.indexOf(nodePositionData.value.segment.docker1); if(index == -1) {return;} nodePositionData.value.segment.docker2 = this.dockers[index + 1]; } }.bind(this)); /* Update attached nodes visual representation */ this.refreshAttachedNodes(); }, /** *@deprecated Use the .createDocker() Method and set the point via the bounds */ addDocker: function(position, exDocker, id){ var lastDocker; var result; this._dockersByPath.any((function(pair){ return pair.value.any((function(docker, index){ if (!lastDocker) { lastDocker = docker; return false; } else { var point1 = lastDocker.bounds.center(); var point2 = docker.bounds.center(); if (ORYX.Core.Math.isPointInLine(position.x, position.y, point1.x, point1.y, point2.x, point2.y, 10)) { var path = this._paths.find(function(path){ return path.id === pair.key; }); if (path) { var allowAttr = path.getAttributeNS(NAMESPACE_ORYX, 'allowDockers'); if (allowAttr && allowAttr.toLowerCase() === "no") { return true; } } var newDocker = (exDocker) ? exDocker : this.createDocker(this.dockers.indexOf(lastDocker) + 1, position, id); newDocker.bounds.centerMoveTo(position); if(exDocker) this.add(newDocker, this.dockers.indexOf(lastDocker) + 1); // Remove new Docker from 'to add' dockers //pair.value = pair.value.without(newDocker); //pair.value.splice(this.dockers.indexOf(lastDocker) + 1, 0, newDocker); // Remove the Docker from the Docker list and add the Docker to the new position //this.dockers = this.dockers.without(newDocker); //this.dockers.splice(this.dockers.indexOf(lastDocker) + 1, 0, newDocker); //this._update(true); result = newDocker; return true; } else { lastDocker = docker; return false; } } }).bind(this)); }).bind(this)); return result; }, removeDocker: function(docker){ if (this.dockers.length > 2 && !(this.dockers.first() === docker)) { this._dockersByPath.any((function(pair){ if (pair.value.member(docker)) { if (docker === pair.value.last()) { return true; } else { this.remove(docker); this._dockersByPath[pair.key] = pair.value.without(docker); this.isChanged = true; this._dockerChanged(); return true; } } return false; }).bind(this)); } }, /** * Removes all dockers from the edge which are on * the line between two dockers * @return {Object} Removed dockers in an indicied array * (key is the removed position of the docker, value is docker themselve) */ removeUnusedDockers:function(){ var marked = $H({}); this.dockers.each(function(docker, i){ if (i==0||i==this.dockers.length-1){ return } var previous = this.dockers[i-1]; /* Do not consider already removed dockers */ if(marked.values().indexOf(previous) != -1 && this.dockers[i-2]) { previous = this.dockers[i-2]; } var next = this.dockers[i+1]; var cp = previous.getDockedShape() && previous.referencePoint ? previous.getAbsoluteReferencePoint() : previous.bounds.center(); var cn = next.getDockedShape() && next.referencePoint ? next.getAbsoluteReferencePoint() : next.bounds.center(); var cd = docker.bounds.center(); if (ORYX.Core.Math.isPointInLine(cd.x, cd.y, cp.x, cp.y, cn.x, cn.y, 1)){ marked[i] = docker; } }.bind(this)) marked.each(function(docker){ this.removeDocker(docker.value); }.bind(this)) if (marked.values().length > 0){ this._update(true); } return marked; }, /** * Initializes the Edge after loading the SVG representation of the edge. * @param {SVGDocument} svgDocument */ _init: function(svgDocument){ arguments.callee.$._init.apply(this, arguments); var minPointX, minPointY, maxPointX, maxPointY; //init markers var defs = svgDocument.getElementsByTagNameNS(NAMESPACE_SVG, "defs"); if (defs.length > 0) { defs = defs[0]; var markerElements = $A(defs.getElementsByTagNameNS(NAMESPACE_SVG, "marker")); var marker; var me = this; markerElements.each(function(markerElement){ try { marker = new ORYX.Core.SVG.SVGMarker(markerElement.cloneNode(true)); me._markers[marker.id] = marker; var textElements = $A(marker.element.getElementsByTagNameNS(NAMESPACE_SVG, "text")); var label; textElements.each(function(textElement){ label = new ORYX.Core.SVG.Label({ textElement: textElement, shapeId: this.id, eventHandler: this._delegateEvent.bind(this), editable: true }); me._labels[label.id] = label; }); } catch (e) { } }); } var gs = svgDocument.getElementsByTagNameNS(NAMESPACE_SVG, "g"); if (gs.length <= 0) { throw "Edge: No g element found."; } var g = gs[0]; g.setAttributeNS(null, "id", null); var isFirst = true; $A(g.childNodes).each((function(path, index){ if (ORYX.Editor.checkClassType(path, SVGPathElement)) { path = path.cloneNode(false); var pathId = this.id + "_" + index; path.setAttributeNS(null, "id", pathId); this._paths.push(path); //check, if markers are set and update the id var markersByThisPath = []; var markerUrl = path.getAttributeNS(null, "marker-start"); if (markerUrl && markerUrl !== "") { markerUrl = markerUrl.strip(); markerUrl = markerUrl.replace(/^url\(#/, ''); var markerStartId = this.id.concat(markerUrl.replace(/\)$/, '')); path.setAttributeNS(null, "marker-start", "url(#" + markerStartId + ")"); markersByThisPath.push(this._markers[markerStartId]); } markerUrl = path.getAttributeNS(null, "marker-mid"); if (markerUrl && markerUrl !== "") { markerUrl = markerUrl.strip(); markerUrl = markerUrl.replace(/^url\(#/, ''); var markerMidId = this.id.concat(markerUrl.replace(/\)$/, '')); path.setAttributeNS(null, "marker-mid", "url(#" + markerMidId + ")"); markersByThisPath.push(this._markers[markerMidId]); } markerUrl = path.getAttributeNS(null, "marker-end"); if (markerUrl && markerUrl !== "") { markerUrl = markerUrl.strip(); markerUrl = markerUrl.replace(/^url\(#/, ''); var markerEndId = this.id.concat(markerUrl.replace(/\)$/, '')); path.setAttributeNS(null, "marker-end", "url(#" + markerEndId + ")"); markersByThisPath.push(this._markers[markerEndId]); } this._markersByPath[pathId] = markersByThisPath; //init dockers var parser = new PathParser(); var handler = new ORYX.Core.SVG.PointsPathHandler(); parser.setHandler(handler); parser.parsePath(path); if (handler.points.length < 4) { throw "Edge: Path has to have two or more points specified."; } this._dockersByPath[pathId] = []; for (var i = 0; i < handler.points.length; i += 2) { //handler.points.each((function(point, pIndex){ var x = handler.points[i]; var y = handler.points[i+1]; if (isFirst || i > 0) { var docker = new ORYX.Core.Controls.Docker({ eventHandlerCallback: this.eventHandlerCallback, "id": this.resourceId + "_" + i }); docker.bounds.centerMoveTo(x,y); docker.bounds.registerCallback(this._dockerChangedCallback); this.add(docker, this.dockers.length); //this._dockersByPath[pathId].push(docker); //calculate minPoint and maxPoint if (minPointX) { minPointX = Math.min(x, minPointX); minPointY = Math.min(y, minPointY); } else { minPointX = x; minPointY = y; } if (maxPointX) { maxPointX = Math.max(x, maxPointX); maxPointY = Math.max(y, maxPointY); } else { maxPointX = x; maxPointY = y; } } //}).bind(this)); } isFirst = false; } }).bind(this)); this.bounds.set(minPointX, minPointY, maxPointX, maxPointY); if (this.bounds.width() === 0 || this.bounds.height() === 0) { this.bounds.extend({ x: this.bounds.width() === 0 ? 2 : 0, y: this.bounds.height() === 0 ? 2 : 0 }); this.bounds.moveBy({ x: this.bounds.width() === 0 ? -1 : 0, y: this.bounds.height() === 0 ? -1 : 0 }); } this._oldBounds = this.bounds.clone(); //add paths to this.node this._paths.reverse(); var paths = []; this._paths.each((function(path){ paths.push(this.node.childNodes[0].childNodes[0].childNodes[0].appendChild(path)); }).bind(this)); this._paths = paths; //init interaction path this._paths.each((function(path){ var iPath = path.cloneNode(false); iPath.setAttributeNS(null, "id", undefined); iPath.setAttributeNS(null, "stroke-width", 10); iPath.setAttributeNS(null, "visibility", "hidden"); iPath.setAttributeNS(null, "stroke-dasharray", null); iPath.setAttributeNS(null, "stroke", "black"); iPath.setAttributeNS(null, "fill", "none"); this._interactionPaths.push(this.node.childNodes[0].childNodes[0].childNodes[0].appendChild(iPath)); }).bind(this)); this._paths.reverse(); this._interactionPaths.reverse(); /**initialize labels*/ var textElems = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text'); $A(textElems).each((function(textElem){ var label = new ORYX.Core.SVG.Label({ textElement: textElem, shapeId: this.id, eventHandler: this._delegateEvent.bind(this), editable: true }); this.node.childNodes[0].childNodes[0].appendChild(label.node); this._labels[label.id] = label; }).bind(this)); //set title this.node.childNodes[0].childNodes[0].setAttributeNS(null, "title", this.getStencil().title()); this.propertiesChanged.each(function(pair){ pair.value = true; }); //this._update(true); }, /** * Adds all necessary markers of this Edge to the SVG document. * Has to be called, while this.node is part of DOM. */ addMarkers: function(defs){ this._markers.each(function(marker){ if (!defs.ownerDocument.getElementById(marker.value.id)) { marker.value.element = defs.appendChild(marker.value.element); } }); }, /** * Removes all necessary markers of this Edge from the SVG document. * Has to be called, while this.node is part of DOM. */ removeMarkers: function(){ var svgElement = this.node.ownerSVGElement; if (svgElement) { var defs = svgElement.getElementsByTagNameNS(NAMESPACE_SVG, "defs"); if (defs.length > 0) { defs = defs[0]; this._markers.each(function(marker){ var foundMarker = defs.ownerDocument.getElementById(marker.value.id); if (foundMarker) { marker.value.element = defs.removeChild(marker.value.element); } }); } } }, /** * Calls when a docker has changed */ _dockerChanged: function(){ //this._update(true); this._dockerUpdated = true; }, serialize: function(){ var result = arguments.callee.$.serialize.apply(this); //add dockers triple var value = ""; this._dockersByPath.each((function(pair){ pair.value.each(function(docker){ var position = docker.getDockedShape() && docker.referencePoint ? docker.referencePoint : docker.bounds.center(); value = value.concat(position.x + " " + position.y + " "); }); value += " # "; }).bind(this)); result.push({ name: 'dockers', prefix: 'oryx', value: value, type: 'literal' }); //add parent triple dependant on the dockedShapes //TODO change this when canvas becomes a resource /* var source = this.dockers.first().getDockedShape(); var target = this.dockers.last().getDockedShape(); var sharedParent; if (source && target) { //get shared parent while (source.parent) { source = source.parent; if (source instanceof ORYX.Core.Canvas) { sharedParent = source; break; } else { var targetParent = target.parent; var found; while (targetParent) { if (source === targetParent) { sharedParent = source; found = true; break; } else { targetParent = targetParent.parent; } } if (found) { break; } } } } else if (source) { sharedParent = source.parent; } else if (target) { sharedParent = target.parent; } */ //if (sharedParent) { /* result.push({ name: 'parent', prefix: 'raziel', //value: '#' + ERDF.__stripHashes(sharedParent.resourceId), value: '#' + ERDF.__stripHashes(this.getCanvas().resourceId), type: 'resource' });*/ //} //serialize target and source var lastDocker = this.dockers.last(); var target = lastDocker.getDockedShape(); if(target) { result.push({ name: 'target', prefix: 'raziel', value: '#' + ERDF.__stripHashes(target.resourceId), type: 'resource' }); } try { //result = this.getStencil().serialize(this, result); var serializeEvent = this.getStencil().serialize(); /* * call serialize callback by reference, result should be found * in serializeEvent.result */ if(serializeEvent.type) { serializeEvent.shape = this; serializeEvent.data = result; serializeEvent.result = undefined; serializeEvent.forceExecution = true; this._delegateEvent(serializeEvent); if(serializeEvent.result) { result = serializeEvent.result; } } } catch (e) { } return result; }, deserialize: function(data){ try { //data = this.getStencil().deserialize(this, data); var deserializeEvent = this.getStencil().deserialize(); /* * call serialize callback by reference, result should be found * in serializeEventInfo.result */ if(deserializeEvent.type) { deserializeEvent.shape = this; deserializeEvent.data = data; deserializeEvent.result = undefined; deserializeEvent.forceExecution = true; this._delegateEvent(deserializeEvent); if(deserializeEvent.result) { data = deserializeEvent.result; } } } catch (e) { } // Set the outgoing shapes var target = data.find(function(ser) {return (ser.prefix+"-"+ser.name) == 'raziel-target'}); var targetShape; if(target) { targetShape = this.getCanvas().getChildShapeByResourceId(target.value); } var outgoing = data.findAll(function(ser){ return (ser.prefix+"-"+ser.name) == 'raziel-outgoing'}); outgoing.each((function(obj){ // TODO: Look at Canvas if(!this.parent) {return}; // Set outgoing Shape var next = this.getCanvas().getChildShapeByResourceId(obj.value); if(next){ if(next == targetShape) { // If this is an edge, set the last docker to the next shape this.dockers.last().setDockedShape(next); this.dockers.last().setReferencePoint({x: next.bounds.width() / 2.0, y: next.bounds.height() / 2.0}); } else if(next instanceof ORYX.Core.Edge) { //Set the first docker of the next shape next.dockers.first().setDockedShape(this); //next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0}); } /*else if(next.dockers.length > 0) { //next is a node and next has a docker next.dockers.first().setDockedShape(this); next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0}); }*/ } }).bind(this)); arguments.callee.$.deserialize.apply(this, [data]); var oryxDockers = data.find(function(obj){ return (obj.prefix === "oryx" && obj.name === "dockers"); }); if (oryxDockers) { var dataByPath = oryxDockers.value.split("#").without("").without(" "); dataByPath.each((function(data, index){ var values = data.replace(/,/g, " ").split(" ").without(""); //for each docker two values must be defined if (values.length % 2 === 0) { var path = this._paths[index]; if (path) { if (index === 0) { while (this._dockersByPath[path.id].length > 2) { this.removeDocker(this._dockersByPath[path.id][1]); } } else { while (this._dockersByPath[path.id].length > 1) { this.removeDocker(this._dockersByPath[path.id][0]); } } var dockersByPath = this._dockersByPath[path.id]; if (index === 0) { //set position of first docker var x = parseFloat(values.shift()); var y = parseFloat(values.shift()); if (dockersByPath.first().getDockedShape()) { dockersByPath.first().setReferencePoint({ x: x, y: y }); } else { dockersByPath.first().bounds.centerMoveTo(x, y); } } //set position of last docker y = parseFloat(values.pop()); x = parseFloat(values.pop()); if (dockersByPath.last().getDockedShape()) { dockersByPath.last().setReferencePoint({ x: x, y: y }); } else { dockersByPath.last().bounds.centerMoveTo(x, y); } //add additional dockers for (var i = 0; i < values.length; i++) { x = parseFloat(values[i]); y = parseFloat(values[++i]); var newDocker = this.createDocker(); newDocker.bounds.centerMoveTo(x, y); //this.dockers = this.dockers.without(newDocker); //this.dockers.splice(this.dockers.indexOf(dockersByPath.last()), 0, newDocker); //dockersByPath.splice(this.dockers.indexOf(dockersByPath.last()), 0, newDocker); } } } }).bind(this)); } else { this.alignDockers(); } this._changed(); }, toString: function(){ return this.getStencil().title() + " " + this.id; }, /** * @return {ORYX.Core.Shape} Returns last docked shape or null. */ getTarget: function(){ return this.dockers.last() ? this.dockers.last().getDockedShape() : null; }, /** * @return {ORYX.Core.Shape} Returns the first docked shape or null */ getSource: function() { return this.dockers.first() ? this.dockers.first().getDockedShape() : null; }, /** * Checks whether the edge is at least docked to one shape. * * @return {boolean} True if edge is docked */ isDocked: function() { var isDocked = false; this.dockers.each(function(docker) { if(docker.isDocked()) { isDocked = true; throw $break; } }); return isDocked; }, /** * Calls {@link ORYX.Core.AbstractShape#toJSON} and add a some stencil set information. */ toJSON: function() { var json = arguments.callee.$.toJSON.apply(this, arguments); if(this.getTarget()) { json.target = { resourceId: this.getTarget().resourceId }; } return json; } }; ORYX.Core.Edge = ORYX.Core.Shape.extend(ORYX.Core.Edge);
08to09-processwave
oryx/editor/client/scripts/Core/edge.js
JavaScript
mit
53,680
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} /** * @classDescription Abstract base class for all objects that have a graphical representation * within the editor. * @extends Clazz */ ORYX.Core.UIObject = { /** * Constructor of the UIObject class. */ construct: function(options) { this.isChanged = true; //Flag, if UIObject has been changed since last update. this.isResized = true; this.isVisible = true; //Flag, if UIObject's display attribute is set to 'inherit' or 'none' this.isSelectable = false; //Flag, if UIObject is selectable. this.isResizable = false; //Flag, if UIObject is resizable. this.isMovable = false; //Flag, if UIObject is movable. if (!options || typeof options["id"] === "undefined") { this.id = ORYX.Editor.provideId(); //get unique id } else { this.id = options["id"]; } this.parent = undefined; //parent is defined, if this object is added to another uiObject. this.node = undefined; //this is a reference to the SVG representation, either locally or in DOM. this.children = []; //array for all add uiObjects this.bounds = new ORYX.Core.Bounds(); //bounds with undefined values this._changedCallback = this._changed.bind(this); //callback reference for calling _changed this.bounds.registerCallback(this._changedCallback); //set callback in bounds if(options && options.eventHandlerCallback) { this.eventHandlerCallback = options.eventHandlerCallback; } }, onOryxShown: function onOryxShown() { var elements = this.node.getElementsByTagName('text'); elements.each(function (e) { var e = Element.extend(e); e.update(e.innerHTML + " "); }); }, /** * Sets isChanged flag to true. Callback for the bounds object. */ _changed: function(bounds, isResized) { this.isChanged = true; if(this.bounds == bounds) this.isResized = isResized || this.isResized; }, /** * If something changed, this method calls the refresh method that must be implemented by subclasses. */ update: function() { if(this.isChanged) { this.refresh(); this.isChanged = false; //call update of all children this.children.each(function(value) { value.update(); }); } }, /** * Is called in update method, if isChanged is set to true. Sub classes should call the super class method. */ refresh: function() { }, /** * @return {Array} Array of all child UIObjects. */ getChildren: function() { return this.children.clone(); }, /** * @return {Array} Array of all parent UIObjects. */ getParents: function(){ var parents = []; var parent = this.parent; while(parent){ parents.push(parent); parent = parent.parent; } return parents; }, /** * Returns TRUE if the given parent is one of the UIObjects parents or the UIObject themselves, otherwise FALSE. * @param {UIObject} parent * @return {Boolean} */ isParent: function(parent){ var cparent = this; while(cparent){ if (cparent === parent){ return true; } cparent = cparent.parent; } return false; }, /** * @return {String} Id of this UIObject */ getId: function() { return this.id; }, /** * Method for accessing child uiObjects by id. * @param {String} id * @param {Boolean} deep * * @return {UIObject} If found, it returns the UIObject with id. */ getChildById: function(id, deep) { return this.children.find(function(uiObj) { if(uiObj.getId() === id) { return uiObj; } else { if(deep) { var obj = uiObj.getChildById(id, deep); if(obj) { return obj; } } } }); }, /** * Adds an UIObject to this UIObject and sets the parent of the * added UIObject. It is also added to the SVG representation of this * UIObject. * @param {UIObject} uiObject */ add: function(uiObject) { //add uiObject, if it is not already a child of this object if (!(this.children.member(uiObject))) { //if uiObject is child of another parent, remove it from that parent. if(uiObject.parent) { uiObject.remove(uiObject); } //add uiObject to children this.children.push(uiObject); //set parent reference uiObject.parent = this; //add uiObject.node to this.node uiObject.node = this.node.appendChild(uiObject.node); //register callback to get informed, if child is changed uiObject.bounds.registerCallback(this._changedCallback); if(this.eventHandlerCallback) this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject}) //uiObject.update(); } else { ORYX.Log.info("add: ORYX.Core.UIObject is already a child of this object."); } }, /** * Removes UIObject from this UIObject. The SVG representation will also * be removed from this UIObject's SVG representation. * @param {UIObject} uiObject */ remove: function(uiObject) { //if uiObject is a child of this object, remove it. if (this.children.member(uiObject)) { //remove uiObject from children this.children = this._uiObjects.without(uiObject); //delete parent reference of uiObject uiObject.parent = undefined; //delete uiObject.node from this.node uiObject.node = this.node.removeChild(uiObject.node); //unregister callback to get informed, if child is changed uiObject.bounds.unregisterCallback(this._changedCallback); } else { ORYX.Log.info("remove: ORYX.Core.UIObject is not a child of this object."); } }, /** * Calculates absolute bounds of this UIObject. */ absoluteBounds: function() { if(this.parent) { var absUL = this.absoluteXY(); return new ORYX.Core.Bounds(absUL.x, absUL.y, absUL.x + this.bounds.width(), absUL.y + this.bounds.height()); } else { return this.bounds.clone(); } }, /** * @return {Point} The absolute position of this UIObject. */ absoluteXY: function() { if(this.parent) { var pXY = this.parent.absoluteXY(); return {x: pXY.x + this.bounds.upperLeft().x , y: pXY.y + this.bounds.upperLeft().y}; } else { return {x: this.bounds.upperLeft().x , y: this.bounds.upperLeft().y}; } }, /** * @return {Point} The absolute position from the Center of this UIObject. */ absoluteCenterXY: function() { if(this.parent) { var pXY = this.parent.absoluteXY(); return {x: pXY.x + this.bounds.center().x , y: pXY.y + this.bounds.center().y}; } else { return {x: this.bounds.center().x , y: this.bounds.center().y}; } }, /** * Hides this UIObject and all its children. */ hide: function() { this.node.setAttributeNS(null, 'display', 'none'); this.isVisible = false; this.children.each(function(uiObj) { uiObj.hide(); }); }, /** * Enables visibility of this UIObject and all its children. */ show: function() { this.node.setAttributeNS(null, 'display', 'inherit'); this.isVisible = true; this.children.each(function(uiObj) { uiObj.show(); }); }, addEventHandlers: function(node) { node.addEventListener(ORYX.CONFIG.EVENT_MOUSEDOWN, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_MOUSEOVER, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_MOUSEOUT, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_CLICK, this._delegateEvent.bind(this), false); node.addEventListener(ORYX.CONFIG.EVENT_DBLCLICK, this._delegateEvent.bind(this), false); }, _delegateEvent: function(event) { if(this.eventHandlerCallback) { this.eventHandlerCallback(event, this); } }, toString: function() { return "UIObject " + this.id } }; ORYX.Core.UIObject = Clazz.extend(ORYX.Core.UIObject);
08to09-processwave
oryx/editor/client/scripts/Core/uiobject.js
JavaScript
mit
9,715
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if(!ORYX){ var ORYX = {} } if(!ORYX.Plugins){ ORYX.Plugins = {} } /** This abstract plugin class can be used to build plugins on. It provides some more basic functionality like registering events (on*-handlers)... @example ORYX.Plugins.MyPlugin = ORYX.Plugins.AbstractPlugin.extend({ construct: function() { // Call super class constructor arguments.callee.$.construct.apply(this, arguments); [...] }, [...] }); @class ORYX.Plugins.AbstractPlugin @constructor Creates a new instance @author Willi Tscheschner */ ORYX.Plugins.AbstractPlugin = Clazz.extend({ /** * The facade which offer editor-specific functionality * @type Facade * @memberOf ORYX.Plugins.AbstractPlugin.prototype */ facade: null, construct: function( facade ){ this.facade = facade; this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LOADED, this.onLoaded.bind(this)); }, /** Overwrite to handle load event. TODO: Document params!!! @methodOf ORYX.Plugins.AbstractPlugin.prototype */ onLoaded: function(){}, /** Overwrite to handle selection changed event. TODO: Document params!!! @methodOf ORYX.Plugins.AbstractPlugin.prototype */ onSelectionChanged: function(){}, /** Show overlay on given shape. @methodOf ORYX.Plugins.AbstractPlugin.prototype @example showOverlay( myShape, { stroke: "green" }, ORYX.Editor.graft("http://www.w3.org/2000/svg", null, ['path', { "title": "Click the element to execute it!", "stroke-width": 2.0, "stroke": "black", "d": "M0,-5 L5,0 L0,5 Z", "line-captions": "round" }]) ) @param {Oryx.XXX.Shape[]} shapes One shape or array of shapes the overlay should be put on @param {Oryx.XXX.Attributes} attributes some attributes... @param {Oryx.svg.node} svgNode The svg node which should be used as overlay @param {String} [svgNode="NW"] The svg node position where the overlay should be placed @param {Boolean} svgNodePositionAbsolute True if position of the overlay is absolute @param {Boolean} keepInsideVisibleArea True if the overlay should be re-positioned to be kept inside of the currently visible area of the canvas */ showOverlay: function(shapes, attributes, svgNode, svgNodePosition, svgNodePositionAbsolute, keepInsideVisibleArea) { if( !(shapes instanceof Array) ){ shapes = [shapes] } // Define Shapes shapes = shapes.map(function(shape){ var el = shape; if( typeof shape == "string" ){ el = this.facade.getCanvas().getChildShapeByResourceId( shape ); el = el || this.facade.getCanvas().getChildById( shape, true ); } return el; }.bind(this)).compact(); // Define unified id if( !this.overlayID ){ this.overlayID = this.type + ORYX.Editor.provideId(); } this.facade.raiseEvent({ type : ORYX.CONFIG.EVENT_OVERLAY_SHOW, id : this.overlayID, shapes : shapes, attributes : attributes, node : svgNode, nodePosition: svgNodePosition || "NW", nodePositionAbsolute: svgNodePositionAbsolute, keepInsideVisibleArea: keepInsideVisibleArea }); }, /** Hide current overlay. @methodOf ORYX.Plugins.AbstractPlugin.prototype */ hideOverlay: function(){ this.facade.raiseEvent({ type : ORYX.CONFIG.EVENT_OVERLAY_HIDE, id : this.overlayID }); }, /** Does a transformation with the given xslt stylesheet. @methodOf ORYX.Plugins.AbstractPlugin.prototype @param {String} data The data (e.g. eRDF) which should be transformed @param {String} stylesheet URL of a stylesheet which should be used for transforming data. */ doTransform: function( data, stylesheet ) { if( !stylesheet || !data ){ return "" } var parser = new DOMParser(); var parsedData = parser.parseFromString(data, "text/xml"); source=stylesheet; new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: function(transport){ xsl = transport.responseText }.bind(this), onFailure: (function(transport){ ORYX.Log.error("XSL load failed" + transport); }).bind(this) }); var xsltProcessor = new XSLTProcessor(); var domParser = new DOMParser(); var xslObject = domParser.parseFromString(xsl, "text/xml"); xsltProcessor.importStylesheet(xslObject); try { var newData = xsltProcessor.transformToFragment(parsedData, document); var serializedData = (new XMLSerializer()).serializeToString(newData); /* Firefox 2 to 3 problem?! */ serializedData = !serializedData.startsWith("<?xml") ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + serializedData : serializedData; return serializedData; }catch (error) { return -1; } }, /** * Opens a new window that shows the given XML content. * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @param {Object} content The XML content to be shown. * @example * openDownloadWindow( "my.xml", "<exampleXML />" ); */ openXMLWindow: function(content) { var win = window.open( 'data:application/xml,' + encodeURIComponent( content ), '_blank', "resizable=yes,width=600,height=600,toolbar=0,scrollbars=yes" ); }, /** * Opens a download window for downloading the given content. * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @param {String} filename The content's file name * @param {String} content The content to download */ openDownloadWindow: function(filename, content) { var win = window.open(""); if (win != null) { win.document.open(); win.document.write("<html><body>"); var submitForm = win.document.createElement("form"); win.document.body.appendChild(submitForm); var createHiddenElement = function(name, value) { var newElement = document.createElement("input"); newElement.name=name; newElement.type="hidden"; newElement.value = value; return newElement } submitForm.appendChild( createHiddenElement("download", content) ); submitForm.appendChild( createHiddenElement("file", filename) ); submitForm.method = "POST"; win.document.write("</body></html>"); win.document.close(); submitForm.action= ORYX.PATH + "/download"; submitForm.submit(); } }, /** * Serializes DOM. * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @type {String} Serialized DOM */ getSerializedDOM: function(){ // Force to set all resource IDs var serializedDOM = DataManager.serializeDOM( this.facade ); //add namespaces serializedDOM = '<?xml version="1.0" encoding="utf-8"?>' + '<html xmlns="http://www.w3.org/1999/xhtml" ' + 'xmlns:b3mn="http://b3mn.org/2007/b3mn" ' + 'xmlns:ext="http://b3mn.org/2007/ext" ' + 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ' + 'xmlns:atom="http://b3mn.org/2007/atom+xhtml">' + '<head profile="http://purl.org/NET/erdf/profile">' + '<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />' + '<link rel="schema.dcTerms" href="http://purl.org/dc/terms/ " />' + '<link rel="schema.b3mn" href="http://b3mn.org" />' + '<link rel="schema.oryx" href="http://oryx-editor.org/" />' + '<link rel="schema.raziel" href="http://raziel.org/" />' + '<base href="' + location.href.split("?")[0] + '" />' + '</head><body>' + serializedDOM + '</body></html>'; return serializedDOM; }, /** * Sets the editor in read only mode: Edges/ dockers cannot be moved anymore, * shapes cannot be selected anymore. * @methodOf ORYX.Plugins.AbstractPlugin.prototype */ enableReadOnlyMode: function(){ //Edges cannot be moved anymore this.facade.disableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN); this.facade.setSelection([], undefined, undefined, true); // Stop the user from editing the diagram while the plugin is active this._stopSelectionChange = function() { if(this.facade.getSelection().length > 0) { this.facade.setSelection([], undefined, undefined, true); } }.bind(this); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange); this.readOnlyMode = true; }, /** * Disables read only mode, see @see * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @see ORYX.Plugins.AbstractPlugin.prototype.enableReadOnlyMode */ disableReadOnlyMode: function(){ // Edges can be moved now again this.facade.enableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN); if (this._stopSelectionChange) { this.facade.unregisterOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange); this._stopSelectionChange = undefined; } this.readOnlyMode = false; }, isReadOnlyMode: function isReadOnlyMode() { return (typeof this.readOnlyMode == 'undefined') ? false : this.readOnlyMode; }, /** * Extracts RDF from DOM. * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @type {String} Extracted RFD. Null if there are transformation errors. */ getRDFFromDOM: function(){ //convert to RDF try { var xsl = ""; source=ORYX.PATH + "lib/extract-rdf.xsl"; new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: function(transport){ xsl = transport.responseText }.bind(this), onFailure: (function(transport){ ORYX.Log.error("XSL load failed" + transport); }).bind(this) }); /* var parser = new DOMParser(); var parsedDOM = parser.parseFromString(this.getSerializedDOM(), "text/xml"); var xsltPath = ORYX.PATH + "lib/extract-rdf.xsl"; var xsltProcessor = new XSLTProcessor(); var xslRef = document.implementation.createDocument("", "", null); xslRef.async = false; xslRef.load(xsltPath); xsltProcessor.importStylesheet(xslRef); try { var rdf = xsltProcessor.transformToDocument(parsedDOM); return (new XMLSerializer()).serializeToString(rdf); } catch (error) { Ext.Msg.alert("Oryx", error); return null; }*/ var domParser = new DOMParser(); var xmlObject = domParser.parseFromString(this.getSerializedDOM(), "text/xml"); var xslObject = domParser.parseFromString(xsl, "text/xml"); var xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xslObject); var result = xsltProcessor.transformToFragment(xmlObject, document); var serializer = new XMLSerializer(); return serializer.serializeToString(result); }catch(e){ Ext.Msg.alert("Oryx", error); return ""; } }, /** * Checks if a certain stencil set is loaded right now. * */ isStencilSetExtensionLoaded: function(stencilSetExtensionNamespace) { return this.facade.getStencilSets().values().any( function(ss){ return ss.extensions().keys().any( function(extensionKey) { return extensionKey == stencilSetExtensionNamespace; }.bind(this) ); }.bind(this) ); }, /** * Raises an event so that registered layouters does * have the posiblility to layout the given shapes * For further reading, have a look into the AbstractLayouter * class * @param {Object} shapes */ doLayout: function(shapes){ // Raises a do layout event this.facade.raiseEvent({ type : ORYX.CONFIG.EVENT_LAYOUT, shapes : shapes }); }, /** * Does a primitive layouting with the incoming/outgoing * edges (set the dockers to the right position) and if * necessary, it will be called the real layouting * @param {ORYX.Core.Node} node * @param {Array} edges */ layoutEdges : function(node, allEdges, offset){ // Find all edges, which are related to the node and // have more than two dockers var edges = allEdges // Find all edges with more than two dockers .findAll(function(r){ return r.dockers.length > 2 }.bind(this)) if (edges.length > 0) { // Get the new absolute center var center = node.absoluteXY(); var ulo = {x: center.x - offset.x, y:center.y - offset.y} center.x += node.bounds.width()/2; center.y += node.bounds.height()/2; // Get the old absolute center oldCenter = Object.clone(center); oldCenter.x -= offset ? offset.x : 0; oldCenter.y -= offset ? offset.y : 0; var ul = {x: center.x - (node.bounds.width() / 2), y: center.y - (node.bounds.height() / 2)} var lr = {x: center.x + (node.bounds.width() / 2), y: center.y + (node.bounds.height() / 2)} /** * Align the bounds if the center is * the same than the old center * @params {Object} bounds * @params {Object} bounds2 */ var align = function(bounds, bounds2){ var xdif = bounds.center().x-bounds2.center().x; var ydif = bounds.center().y-bounds2.center().y; if (Math.abs(xdif) < 3){ bounds.moveBy({x:(offset.xs?(((offset.xs*(bounds.center().x-ulo.x))+offset.x+ulo.x)-bounds.center().x):offset.x)-xdif, y:0}); } else if (Math.abs(ydif) < 3){ bounds.moveBy({x:0, y:(offset.ys?(((offset.ys*(bounds.center().y-ulo.y))+offset.y+ulo.y)-bounds.center().y):offset.y)-ydif}); } }; /** * Returns a TRUE if there are bend point which overlay the shape */ var isBendPointIncluded = function(edge){ // Get absolute bounds var ab = edge.dockers.first().getDockedShape(); var bb = edge.dockers.last().getDockedShape(); if (ab) { ab = ab.absoluteBounds(); ab.widen(5); } if (bb) { bb = bb.absoluteBounds(); bb.widen(20); // Wide with 20 because of the arrow from the edge } return edge.dockers .any(function(docker, i){ var c = docker.bounds.center(); // Dont count first and last return i != 0 && i != edge.dockers.length-1 && // Check if the point is included to the absolute bounds ((ab && ab.isIncluded(c)) || (bb && bb.isIncluded(c))) }) } // For every edge, check second and one before last docker // if there are horizontal/vertical on the same level // and if so, align the the bounds edges.each(function(edge){ if (edge.dockers.first().getDockedShape() === node){ var second = edge.dockers[1]; if (align(second.bounds, edge.dockers.first().bounds)){ second.update(); } } else if (edge.dockers.last().getDockedShape() === node) { var beforeLast = edge.dockers[edge.dockers.length-2]; if (align(beforeLast.bounds, edge.dockers.last().bounds)){ beforeLast.update(); } } edge._update(true); // Unused dockers create inconsistent states across remote clients //edge.removeUnusedDockers(); if (isBendPointIncluded(edge)){ this.doLayout(edge); return; } }.bind(this)) } // Find all edges, which have only to dockers // and is located horizontal/vertical. // Do layout with those edges allEdges.each(function(edge){ // Find all edges with two dockers if (edge.dockers.length == 2){ var p1 = edge.dockers.first().bounds.center(); var p2 = edge.dockers.last().bounds.center(); // Find all horizontal/vertical edges if (Math.abs(p1.x - p2.x) < 2 || Math.abs(p1.y - p2.y) < 2){ edge.dockers.first().update(); edge.dockers.last().update(); this.doLayout(edge); } } }.bind(this)); } });
08to09-processwave
oryx/editor/client/scripts/Core/abstractPlugin.js
JavaScript
mit
17,933
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} /** * @classDescription Base class for Shapes. * @extends ORYX.Core.AbstractShape */ ORYX.Core.Shape = { /** * Constructor */ construct: function(options, stencil) { // call base class constructor arguments.callee.$.construct.apply(this, arguments); this.dockers = []; this.magnets = []; this._defaultMagnet; this.incoming = []; this.outgoing = []; this.nodes = []; this._dockerChangedCallback = this._dockerChanged.bind(this); //Hash map for all labels. Labels are not treated as children of shapes. this._labels = new Hash(); // create SVG node this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg", null, ['g', {id:this.id}, ['g', {"class": "stencils"}, ['g', {"class": "me"}], ['g', {"class": "children", style:"overflow:hidden"}], ['g', {"class": "edge"}] ], ['g', {"class": "controls"}, ['g', {"class": "dockers"}], ['g', {"class": "magnets"}] ] ]); this.metadata = { changedBy: [], changedAt: [], commands: [], isLocal: false } }, lastChangeWasLocal: function lastChangeWasLocal() { return this.metadata.isLocal; }, getLastCommandDisplayName: function getLastCommandDisplayName() { if (this.metadata.commands.length === 0) { return undefined; } return this.metadata.commands[this.metadata.commands.length - 1]; }, getLastChangedBy: function getLastChangedBy() { if (this.metadata.changedBy.length === 0) { return undefined; } return this.metadata.changedBy[this.metadata.changedBy.length - 1]; }, getLastChangedAt: function getLastChangedBy() { if (this.metadata.changedAt.length === 0) { return undefined; } return this.metadata.changedAt[this.metadata.changedAt.length - 1]; }, /** * If changed flag is set, refresh method is called. */ update: function() { //if(this.isChanged) { //this.layout(); //} }, /** * !!!Not called from any sub class!!! */ _update: function() { }, /** * Calls the super class refresh method * and updates the svg elements that are referenced by a property. */ refresh: function() { //call base class refresh method arguments.callee.$.refresh.apply(this, arguments); if(this.node.ownerDocument) { //adjust SVG to properties' values var me = this; this.propertiesChanged.each((function(propChanged) { if(propChanged.value) { var prop = this.properties[propChanged.key]; var property = this.getStencil().property(propChanged.key); this.propertiesChanged[propChanged.key] = false; //handle choice properties if(property.type() == ORYX.CONFIG.TYPE_CHOICE) { //iterate all references to SVG elements property.refToView().each((function(ref) { //if property is referencing a label, update the label if(ref !== "") { var label = this._labels[this.id + ref]; if (label) { label.text(property.item(prop).value()); } } }).bind(this)); //if the choice's items are referencing SVG elements // show the selected and hide all other referenced SVG // elements var refreshedSvgElements = new Hash(); property.items().each((function(item) { item.refToView().each((function(itemRef) { if(itemRef == "") { this.propertiesChanged[propChanged.key] = true; return; } var svgElem = this.node.ownerDocument.getElementById(this.id + itemRef); if(!svgElem) { this.propertiesChanged[propChanged.key] = true; return; } /* Do not refresh the same svg element multiple times */ if(!refreshedSvgElements[svgElem.id] || prop == item.value()) { svgElem.setAttributeNS(null, 'display', ((prop == item.value()) ? 'inherit' : 'none')); refreshedSvgElements[svgElem.id] = svgElem; } // Reload the href if there is an image-tag if(ORYX.Editor.checkClassType(svgElem, SVGImageElement)) { svgElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', svgElem.getAttributeNS('http://www.w3.org/1999/xlink', 'href')); } }).bind(this)); }).bind(this)); } else { //handle properties that are not of type choice //iterate all references to SVG elements property.refToView().each((function(ref) { //if the property does not reference an SVG element, // do nothing if(ref === "") { this.propertiesChanged[propChanged.key] = true; return; } var refId = this.id + ref; //get the SVG element var svgElem = this.node.ownerDocument.getElementById(refId); //if the SVG element can not be found if(!svgElem || !(svgElem.ownerSVGElement)) { //if the referenced SVG element is a SVGAElement, it cannot // be found with getElementById (Firefox bug). // this is a work around if(property.type() === ORYX.CONFIG.TYPE_URL || property.type() === ORYX.CONFIG.TYPE_DIAGRAM_LINK) { var svgElems = this.node.ownerDocument.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'a'); svgElem = $A(svgElems).find(function(elem) { return elem.getAttributeNS(null, 'id') === refId; }); if(!svgElem) { this.propertiesChanged[propChanged.key] = true; return; } } else { this.propertiesChanged[propChanged.key] = true; return; } } if (property.complexAttributeToView()) { var label = this._labels[refId]; if (label) { try { propJson = prop.evalJSON(); var value = propJson[property.complexAttributeToView()] label.text(value ? value : prop); } catch (e) { label.text(prop); } } } else { switch (property.type()) { case ORYX.CONFIG.TYPE_BOOLEAN: if (typeof prop == "string") prop = prop === "true" svgElem.setAttributeNS(null, 'display', (!(prop === property.inverseBoolean())) ? 'inherit' : 'none'); break; case ORYX.CONFIG.TYPE_COLOR: if(property.fill()) { if (svgElem.tagName.toLowerCase() === "stop"){ svgElem.setAttributeNS(null, "stop-color", prop); // Adjust stop color of the others if (svgElem.parentNode.tagName.toLowerCase() === "radialgradient"){ ORYX.Utils.adjustGradient(svgElem.parentNode, svgElem); } } else { svgElem.setAttributeNS(null, 'fill', prop); } } if(property.stroke()) { svgElem.setAttributeNS(null, 'stroke', prop); } break; case ORYX.CONFIG.TYPE_STRING: var label = this._labels[refId]; if (label) { label.text(prop); } break; case ORYX.CONFIG.TYPE_INTEGER: var label = this._labels[refId]; if (label) { label.text(prop); } break; case ORYX.CONFIG.TYPE_FLOAT: if(property.fillOpacity()) { svgElem.setAttributeNS(null, 'fill-opacity', prop); } if(property.strokeOpacity()) { svgElem.setAttributeNS(null, 'stroke-opacity', prop); } if(!property.fillOpacity() && !property.strokeOpacity()) { var label = this._labels[refId]; if (label) { label.text(prop); } } break; case ORYX.CONFIG.TYPE_URL: case ORYX.CONFIG.TYPE_DIAGRAM_LINK: //TODO what is the dafault path? var hrefAttr = svgElem.getAttributeNodeNS('http://www.w3.org/1999/xlink', 'xlink:href'); // in collaborative mode links will only work if the property for the link has been set if (ORYX.CONFIG.COLLABORATION && prop == "") { break; } if(hrefAttr) { hrefAttr.textContent = prop; } else { svgElem.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', prop); } break; } } }).bind(this)); } } }).bind(this)); //update labels this._labels.values().each(function(label) { label.update(); }); } }, layout: function() { //this.getStencil().layout(this) var layoutEvents = this.getStencil().layout() if(this instanceof ORYX.Core.Node && layoutEvents) { layoutEvents.each(function(event) { // setup additional attributes event.shape = this; event.forceExecution = true; // do layouting this._delegateEvent(event); }.bind(this)) } }, /** * Returns an array of Label objects. */ getLabels: function() { return this._labels.values(); }, /** * Returns an array of dockers of this object. */ getDockers: function() { return this.dockers; }, getMagnets: function() { return this.magnets; }, getDefaultMagnet: function() { if(this._defaultMagnet) { return this._defaultMagnet; } else if (this.magnets.length > 0) { return this.magnets[0]; } else { return undefined; } }, getParentShape: function() { return this.parent; }, getIncomingShapes: function(iterator) { if(iterator) { this.incoming.each(iterator); } return this.incoming; }, getIncomingNodes: function(iterator) { return this.incoming.select(function(incoming){ var isNode = (incoming instanceof ORYX.Core.Node); if(isNode && iterator) iterator(incoming); return isNode; }); }, getOutgoingShapes: function(iterator) { if(iterator) { this.outgoing.each(iterator); } return this.outgoing; }, getOutgoingNodes: function(iterator) { return this.outgoing.select(function(out){ var isNode = (out instanceof ORYX.Core.Node); if(isNode && iterator) iterator(out); return isNode; }); }, getAllDockedShapes: function(iterator) { var result = this.incoming.concat(this.outgoing); if(iterator) { result.each(iterator); } return result }, getCanvas: function() { if(this.parent instanceof ORYX.Core.Canvas) { return this.parent; } else if(this.parent instanceof ORYX.Core.Shape) { return this.parent.getCanvas(); } else { return undefined; } }, /** * * @param {Object} deep * @param {Object} iterator */ getChildNodes: function(deep, iterator) { if(!deep && !iterator) { return this.nodes.clone(); } else { var result = []; this.nodes.each(function(uiObject) { if(!uiObject.isVisible){return} if(iterator) { iterator(uiObject); } result.push(uiObject); if(deep && uiObject instanceof ORYX.Core.Shape) { result = result.concat(uiObject.getChildNodes(deep, iterator)); } }); return result; } }, /** * Overrides the UIObject.add method. Adds uiObject to the correct sub node. * @param {UIObject} uiObject * @param {Number} index */ add: function(uiObject, index) { //parameter has to be an UIObject, but // must not be an Edge. if(uiObject instanceof ORYX.Core.UIObject && !(uiObject instanceof ORYX.Core.Edge)) { if (!(this.children.member(uiObject))) { //if uiObject is child of another parent, remove it from that parent. if(uiObject.parent) { uiObject.parent.remove(uiObject); } //add uiObject to this Shape if(index != undefined) this.children.splice(index, 0, uiObject); else this.children.push(uiObject); //set parent reference uiObject.parent = this; //add uiObject.node to this.node depending on the type of uiObject var parent; if(uiObject instanceof ORYX.Core.Node) { parent = this.node.childNodes[0].childNodes[1]; this.nodes.push(uiObject); } else if(uiObject instanceof ORYX.Core.Controls.Control) { var ctrls = this.node.childNodes[1]; if(uiObject instanceof ORYX.Core.Controls.Docker) { parent = ctrls.childNodes[0]; if (this.dockers.length >= 2){ this.dockers.splice(index!==undefined?Math.min(index, this.dockers.length-1):this.dockers.length-1, 0, uiObject); } else { this.dockers.push(uiObject); } } else if(uiObject instanceof ORYX.Core.Controls.Magnet) { parent = ctrls.childNodes[1]; this.magnets.push(uiObject); } else { parent = ctrls; } } else { //UIObject parent = this.node; } if(index != undefined && index < parent.childNodes.length) uiObject.node = parent.insertBefore(uiObject.node, parent.childNodes[index]); else uiObject.node = parent.appendChild(uiObject.node); this._changed(); //uiObject.bounds.registerCallback(this._changedCallback); if(this.eventHandlerCallback) this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject}) } else { ORYX.Log.warn("add: ORYX.Core.UIObject is already a child of this object."); } } else { ORYX.Log.warn("add: Parameter is not of type ORYX.Core.UIObject."); } }, /** * Overrides the UIObject.remove method. Removes uiObject. * @param {UIObject} uiObject */ remove: function(uiObject) { //if uiObject is a child of this object, remove it. if (this.children.member(uiObject)) { //remove uiObject from children this.children = this.children.without(uiObject); //delete parent reference of uiObject uiObject.parent = undefined; //delete uiObject.node from this.node if(uiObject instanceof ORYX.Core.Shape) { if(uiObject instanceof ORYX.Core.Edge) { uiObject.removeMarkers(); uiObject.node = this.node.childNodes[0].childNodes[2].removeChild(uiObject.node); } else { uiObject.node = this.node.childNodes[0].childNodes[1].removeChild(uiObject.node); this.nodes = this.nodes.without(uiObject); } } else if(uiObject instanceof ORYX.Core.Controls.Control) { if (uiObject instanceof ORYX.Core.Controls.Docker) { uiObject.node = this.node.childNodes[1].childNodes[0].removeChild(uiObject.node); this.dockers = this.dockers.without(uiObject); } else if (uiObject instanceof ORYX.Core.Controls.Magnet) { uiObject.node = this.node.childNodes[1].childNodes[1].removeChild(uiObject.node); this.magnets = this.magnets.without(uiObject); } else { uiObject.node = this.node.childNodes[1].removeChild(uiObject.node); } } this._changed(); //uiObject.bounds.unregisterCallback(this._changedCallback); } else { ORYX.Log.warn("remove: ORYX.Core.UIObject is not a child of this object."); } }, /** * Calculate the Border Intersection Point between two points * @param {PointA} * @param {PointB} */ getIntersectionPoint: function() { var pointAX, pointAY, pointBX, pointBY; // Get the the two Points switch(arguments.length) { case 2: pointAX = arguments[0].x; pointAY = arguments[0].y; pointBX = arguments[1].x; pointBY = arguments[1].y; break; case 4: pointAX = arguments[0]; pointAY = arguments[1]; pointBX = arguments[2]; pointBY = arguments[3]; break; default: throw "getIntersectionPoints needs two or four arguments"; } // Defined an include and exclude point var includePointX, includePointY, excludePointX, excludePointY; var bounds = this.absoluteBounds(); if(this.isPointIncluded(pointAX, pointAY, bounds)){ includePointX = pointAX; includePointY = pointAY; } else { excludePointX = pointAX; excludePointY = pointAY; } if(this.isPointIncluded(pointBX, pointBY, bounds)){ includePointX = pointBX; includePointY = pointBY; } else { excludePointX = pointBX; excludePointY = pointBY; } // If there is no inclue or exclude Shape, than return if(!includePointX || !includePointY || !excludePointX || !excludePointY) { return undefined; } var midPointX = 0; var midPointY = 0; var refPointX, refPointY; var minDifferent = 1; // Get the UpperLeft and LowerRight //var ul = bounds.upperLeft(); //var lr = bounds.lowerRight(); var i = 0; while(true) { // Calculate the midpoint of the current to points var midPointX = Math.min(includePointX, excludePointX) + ((Math.max(includePointX, excludePointX) - Math.min(includePointX, excludePointX)) / 2.0); var midPointY = Math.min(includePointY, excludePointY) + ((Math.max(includePointY, excludePointY) - Math.min(includePointY, excludePointY)) / 2.0); // Set the new midpoint by the means of the include of the bounds if(this.isPointIncluded(midPointX, midPointY, bounds)){ includePointX = midPointX; includePointY = midPointY; } else { excludePointX = midPointX; excludePointY = midPointY; } // Calc the length of the line var length = Math.sqrt(Math.pow(includePointX - excludePointX, 2) + Math.pow(includePointY - excludePointY, 2)) // Calc a point one step from the include point refPointX = includePointX + ((excludePointX - includePointX) / length), refPointY = includePointY + ((excludePointY - includePointY) / length) // If the reference point not in the bounds, break if(!this.isPointIncluded(refPointX, refPointY, bounds)) { break } } // Return the last includepoint return {x:refPointX , y:refPointY}; }, /** * Calculate if the point is inside the Shape * @param {PointX} * @param {PointY} */ isPointIncluded: function(){ return false }, /** * Calculate if the point is over an special offset area * @param {Point} */ isPointOverOffset: function(){ return this.isPointIncluded.apply( this , arguments ) }, _dockerChanged: function() { }, /** * Create a Docker for this Edge * */ createDocker: function(index, position, id) { var docker = new ORYX.Core.Controls.Docker({eventHandlerCallback: this.eventHandlerCallback, "id": id}); docker.bounds.registerCallback(this._dockerChangedCallback); if(position) { docker.bounds.centerMoveTo(position); } this.add(docker, index); return docker }, /** * Get the serialized object * return Array with hash-entrees (prefix, name, value) * Following values will given: * Bounds * Outgoing Shapes * Parent */ serialize: function() { var serializedObject = arguments.callee.$.serialize.apply(this); // Add the bounds serializedObject.push({name: 'bounds', prefix:'oryx', value: this.bounds.serializeForERDF(), type: 'literal'}); // Add the outgoing shapes this.getOutgoingShapes().each((function(followingShape){ serializedObject.push({name: 'outgoing', prefix:'raziel', value: '#'+ERDF.__stripHashes(followingShape.resourceId), type: 'resource'}); }).bind(this)); // Add the parent shape, if the parent not the canvas //if(this.parent instanceof ORYX.Core.Shape){ serializedObject.push({name: 'parent', prefix:'raziel', value: '#'+ERDF.__stripHashes(this.parent.resourceId), type: 'resource'}); //} return serializedObject; }, deserialize: function(serialze){ arguments.callee.$.deserialize.apply(this, arguments); // Set the Bounds var bounds = serialze.find(function(ser){ return (ser.prefix+"-"+ser.name) == 'oryx-bounds'}); if(bounds) { var b = bounds.value.replace(/,/g, " ").split(" ").without(""); if(this instanceof ORYX.Core.Edge){ this.dockers.first().bounds.centerMoveTo(parseFloat(b[0]), parseFloat(b[1])); this.dockers.last().bounds.centerMoveTo(parseFloat(b[2]), parseFloat(b[3])); } else { this.bounds.set(parseFloat(b[0]), parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])); } } }, /** * Private methods. */ /** * Child classes have to overwrite this method for initializing a loaded * SVG representation. * @param {SVGDocument} svgDocument */ _init: function(svgDocument) { //adjust ids this._adjustIds(svgDocument, 0); }, _adjustIds: function(element, idIndex) { if(element instanceof Element) { var eid = element.getAttributeNS(null, 'id'); if(eid && eid !== "") { element.setAttributeNS(null, 'id', this.id + eid); } else { element.setAttributeNS(null, 'id', this.id + "_" + this.id + "_" + idIndex); idIndex++; } // Replace URL in fill attribute var fill = element.getAttributeNS(null, 'fill'); if (fill&&fill.include("url(#")){ fill = fill.replace(/url\(#/g, 'url(#'+this.id); element.setAttributeNS(null, 'fill', fill); } if(element.hasChildNodes()) { for(var i = 0; i < element.childNodes.length; i++) { idIndex = this._adjustIds(element.childNodes[i], idIndex); } } } return idIndex; }, toString: function() { return "ORYX.Core.Shape " + this.getId() } }; ORYX.Core.Shape = ORYX.Core.AbstractShape.extend(ORYX.Core.Shape);
08to09-processwave
oryx/editor/client/scripts/Core/shape.js
JavaScript
mit
23,554
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};} /** * @classDescription Represents a movable docker that can be bound to a shape. Dockers are used * for positioning shape objects. * @extends {Control} * * TODO absoluteXY und absoluteCenterXY von einem Docker liefern falsche Werte!!! */ ORYX.Core.Controls.Docker = ORYX.Core.Controls.Control.extend({ /** * Constructor */ construct: function() { arguments.callee.$.construct.apply(this, arguments); this.isMovable = true; // Enables movability this.bounds.set(0, 0, 16, 16); // Set the bounds this.referencePoint = undefined; // Refrenzpoint this._dockedShapeBounds = undefined; this._dockedShape = undefined; this._oldRefPoint1 = undefined; this._oldRefPoint2 = undefined; //this.anchors = []; this.anchorLeft; this.anchorRight; this.anchorTop; this.anchorBottom; this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg", null, ['g']); // The DockerNode reprasentation this._dockerNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", this.node, ['g', {"pointer-events":"all"}, ['circle', {cx:"8", cy:"8", r:"8", stroke:"none", fill:"none"}], ['circle', {cx:"8", cy:"8", r:"3", stroke:"black", fill:"red", "stroke-width":"1"}] ]); // The ReferenzNode reprasentation this._referencePointNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", this.node, ['g', {"pointer-events":"none"}, ['circle', {cx: this.bounds.upperLeft().x, cy: this.bounds.upperLeft().y, r: 3, fill:"red", "fill-opacity":0.4}]]); // Hide the Docker this.hide(); //Add to the EventHandler this.addEventHandlers(this.node); // Buffer the Update Callback for un-/register on Event-Handler this._updateCallback = this._changed.bind(this); }, /** * @return {Point} The absolute position of this Docker. * Dockers seem to be positioned relative to their parent's parent (instead of their parent like all other UIObjects are). * Thus we have to ignore the docker's direct parent when calculating the absolute position. */ absoluteXY: function() { if(this.parent) { // Skipping the parent's absolute position. var pXY = this.parent.parent.absoluteXY(); return {x: pXY.x + this.bounds.upperLeft().x , y: pXY.y + this.bounds.upperLeft().y}; } else { return {x: this.bounds.upperLeft().x , y: this.bounds.upperLeft().y}; } }, update: function() { // If there have an DockedShape if(this._dockedShape) { if(this._dockedShapeBounds && this._dockedShape instanceof ORYX.Core.Node) { // Calc the delta of width and height of the lastBounds and the current Bounds var dswidth = this._dockedShapeBounds.width(); var dsheight = this._dockedShapeBounds.height(); if(!dswidth) dswidth = 1; if(!dsheight) dsheight = 1; var widthDelta = this._dockedShape.bounds.width() / dswidth; var heightDelta = this._dockedShape.bounds.height() / dsheight; // If there is an different if(widthDelta !== 1.0 || heightDelta !== 1.0) { // Set the delta this.referencePoint.x *= widthDelta; this.referencePoint.y *= heightDelta; } // Clone these bounds this._dockedShapeBounds = this._dockedShape.bounds.clone(); } // Get the first and the last Docker of the parent Shape var dockerIndex = this.parent.dockers.indexOf(this) var dock1 = this; var dock2 = this.parent.dockers.length > 1 ? (dockerIndex === 0? // If there is the first element this.parent.dockers[dockerIndex + 1]: // then take the next docker this.parent.dockers[dockerIndex - 1]): // if not, then take the docker before undefined; // Calculate the first absolute Refenzpoint var absoluteReferenzPoint1 = dock1.getDockedShape() ? dock1.getAbsoluteReferencePoint() : dock1.bounds.center(); // Calculate the last absolute Refenzpoint var absoluteReferenzPoint2 = dock2 && dock2.getDockedShape() ? dock2.getAbsoluteReferencePoint() : dock2 ? dock2.bounds.center() : undefined; // If there is no last absolute Referenzpoint if(!absoluteReferenzPoint2) { // Calculate from the middle of the DockedShape var center = this._dockedShape.absoluteCenterXY(); var minDimension = this._dockedShape.bounds.width() * this._dockedShape.bounds.height(); absoluteReferenzPoint2 = { x: absoluteReferenzPoint1.x + (center.x - absoluteReferenzPoint1.x) * -minDimension, y: absoluteReferenzPoint1.y + (center.y - absoluteReferenzPoint1.y) * -minDimension } } var newPoint = undefined; /*if (!this._oldRefPoint1 || !this._oldRefPoint2 || absoluteReferenzPoint1.x !== this._oldRefPoint1.x || absoluteReferenzPoint1.y !== this._oldRefPoint1.y || absoluteReferenzPoint2.x !== this._oldRefPoint2.x || absoluteReferenzPoint2.y !== this._oldRefPoint2.y) {*/ // Get the new point for the Docker, calucalted by the intersection point of the Shape and the two points newPoint = this._dockedShape.getIntersectionPoint(absoluteReferenzPoint1, absoluteReferenzPoint2); // If there is new point, take the referencepoint as the new point if(!newPoint) { newPoint = this.getAbsoluteReferencePoint(); } if(this.parent && this.parent.parent) { var grandParentPos = this.parent.parent.absoluteXY(); newPoint.x -= grandParentPos.x; newPoint.y -= grandParentPos.y; } // Set the bounds to the new point this.bounds.centerMoveTo(newPoint) this._oldRefPoint1 = absoluteReferenzPoint1; this._oldRefPoint2 = absoluteReferenzPoint2; } /*else { newPoint = this.bounds.center(); }*/ // } // Call the super class arguments.callee.$.update.apply(this, arguments); }, /** * Calls the super class refresh method and updates the view of the docker. */ refresh: function() { arguments.callee.$.refresh.apply(this, arguments); // Refresh the dockers node var p = this.bounds.upperLeft(); this._dockerNode.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')'); // Refresh the referencepoints node p = Object.clone(this.referencePoint); if(p && this._dockedShape){ var upL if(this.parent instanceof ORYX.Core.Edge) { upL = this._dockedShape.absoluteXY(); } else { upL = this._dockedShape.bounds.upperLeft(); } p.x += upL.x; p.y += upL.y; } else { p = this.bounds.center(); } this._referencePointNode.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')'); }, /** * Set the reference point * @param {Object} point */ setReferencePoint: function(point) { // Set the referencepoint if(this.referencePoint !== point && (!this.referencePoint || !point || this.referencePoint.x !== point.x || this.referencePoint.y !== point.y)) { this.referencePoint = point; this._changed(); } // Update directly, because the referencepoint has no influence of the bounds //this.refresh(); }, /** * Get the absolute referencepoint */ getAbsoluteReferencePoint: function() { if(!this.referencePoint || !this._dockedShape) { return undefined; } else { var absUL = this._dockedShape.absoluteXY(); return { x: this.referencePoint.x + absUL.x, y: this.referencePoint.y + absUL.y } } }, /** * Set the docked Shape from the docker * @param {Object} shape */ setDockedShape: function(shape) { // If there is an old docked Shape if(this._dockedShape) { this._dockedShape.bounds.unregisterCallback(this._updateCallback) // Delete the Shapes from the incoming and outgoing array // If this Docker the incoming of the Shape if(this === this.parent.dockers.first()) { this.parent.incoming = this.parent.incoming.without(this._dockedShape); this._dockedShape.outgoing = this._dockedShape.outgoing.without(this.parent); // If this Docker the outgoing of the Shape } else if (this === this.parent.dockers.last()){ this.parent.outgoing = this.parent.outgoing.without(this._dockedShape); this._dockedShape.incoming = this._dockedShape.incoming.without(this.parent); } } // Set the new Shape this._dockedShape = shape; this._dockedShapeBounds = undefined; var referencePoint = undefined; // If there is an Shape, register the updateCallback if there are changes in the shape bounds if(this._dockedShape) { // Add the Shapes to the incoming and outgoing array // If this Docker the incoming of the Shape if(this === this.parent.dockers.first()) { this.parent.incoming.push(shape); shape.outgoing.push(this.parent); // If this Docker the outgoing of the Shape } else if (this === this.parent.dockers.last()){ this.parent.outgoing.push(shape); shape.incoming.push(this.parent); } // Get the bounds and set the new referencepoint var bounds = this.bounds; var absUL = shape.absoluteXY(); /*if(shape.parent){ var b = shape.parent.bounds.upperLeft(); absUL.x -= b.x; absUL.y -= b.y; }*/ referencePoint = { x: bounds.center().x - absUL.x, y: bounds.center().y - absUL.y } this._dockedShapeBounds = this._dockedShape.bounds.clone(); this._dockedShape.bounds.registerCallback(this._updateCallback); // Set the color of the docker as docked this.setDockerColor(ORYX.CONFIG.DOCKER_DOCKED_COLOR); } else { // Set the color of the docker as undocked this.setDockerColor(ORYX.CONFIG.DOCKER_UNDOCKED_COLOR); } // Set the referencepoint this.setReferencePoint(referencePoint); this._changed(); //this.update(); }, /** * Get the docked Shape */ getDockedShape: function() { return this._dockedShape; }, /** * Returns TRUE if the docker has a docked shape */ isDocked: function() { return !!this._dockedShape; }, /** * Set the Color of the Docker * @param {Object} color */ setDockerColor: function(color) { this._dockerNode.lastChild.setAttributeNS(null, "fill", color); }, /** * Hides this UIObject and all its children. */ hide: function() { this.node.setAttributeNS(null, 'visibility', 'hidden'); this.children.each(function(uiObj) { uiObj.hide(); }); }, /** * Enables visibility of this UIObject and all its children. */ show: function() { this.node.setAttributeNS(null, 'visibility', 'visible'); this.children.each(function(uiObj) { uiObj.show(); }); }, toString: function() { return "Docker " + this.id } });
08to09-processwave
oryx/editor/client/scripts/Core/Controls/docker.js
JavaScript
mit
12,612
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};} /** * @classDescription Abstract base class for all Controls. */ ORYX.Core.Controls.Control = ORYX.Core.UIObject.extend({ toString: function() { return "Control " + this.id; } });
08to09-processwave
oryx/editor/client/scripts/Core/Controls/control.js
JavaScript
mit
1,806
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};} /** * @classDescription Represents a magnet that is part of another shape and can * be attached to dockers. Magnets are used for linking edge objects * to other Shape objects. * @extends {Control} */ ORYX.Core.Controls.Magnet = ORYX.Core.Controls.Control.extend({ /** * Constructor */ construct: function() { arguments.callee.$.construct.apply(this, arguments); //this.anchors = []; this.anchorLeft; this.anchorRight; this.anchorTop; this.anchorBottom; this.bounds.set(0, 0, 16, 16); //graft magnet's root node into owner's control group. this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg", null, ['g', {"pointer-events":"all"}, ['circle', {cx:"8", cy:"8", r:"4", stroke:"none", fill:"red", "fill-opacity":"0.3"}] ]); this.hide(); }, update: function() { arguments.callee.$.update.apply(this, arguments); //this.isChanged = true; }, _update: function() { arguments.callee.$.update.apply(this, arguments); //this.isChanged = true; }, refresh: function() { arguments.callee.$.refresh.apply(this, arguments); var p = this.bounds.upperLeft(); /*if(this.parent) { var parentPos = this.parent.bounds.upperLeft(); p.x += parentPos.x; p.y += parentPos.y; }*/ this.node.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')'); }, show: function() { //this.refresh(); arguments.callee.$.show.apply(this, arguments); }, toString: function() { return "Magnet " + this.id; } });
08to09-processwave
oryx/editor/client/scripts/Core/Controls/magnet.js
JavaScript
mit
3,199
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if (!ORYX) { var ORYX = {}; } if (!ORYX.Core) { ORYX.Core = {}; } /** * @classDescription Abstract base class for all Nodes. * @extends ORYX.Core.Shape */ ORYX.Core.Node = { /** * Constructor * @param options {Object} A container for arguments. * @param stencil {Stencil} */ construct: function(options, stencil){ arguments.callee.$.construct.apply(this, arguments); this.isSelectable = true; this.isMovable = true; this._dockerUpdated = false; this._oldBounds = new ORYX.Core.Bounds(); //init bounds with undefined values this._svgShapes = []; //array of all SVGShape objects of // SVG representation //TODO vielleicht in shape verschieben? this.minimumSize = undefined; // {width:..., height:...} this.maximumSize = undefined; //TODO vielleicht in shape oder uiobject verschieben? // vielleicht sogar isResizable ersetzen? this.isHorizontallyResizable = false; this.isVerticallyResizable = false; this.dataId = undefined; this._init(this._stencil.view()); }, /** * This method checks whether the shape is resized correctly and calls the * super class update method. */ _update: function(){ this.dockers.invoke("update"); if (this.isChanged) { var bounds = this.bounds; var oldBounds = this._oldBounds; if (this.isResized) { var widthDelta = bounds.width() / oldBounds.width(); var heightDelta = bounds.height() / oldBounds.height(); //iterate over all relevant svg elements and resize them this._svgShapes.each(function(svgShape){ //adjust width if (svgShape.isHorizontallyResizable) { svgShape.width = svgShape.oldWidth * widthDelta; } //adjust height if (svgShape.isVerticallyResizable) { svgShape.height = svgShape.oldHeight * heightDelta; } //check, if anchors are set var anchorOffset; var leftIncluded = svgShape.anchorLeft; var rightIncluded = svgShape.anchorRight; if (rightIncluded) { anchorOffset = oldBounds.width() - (svgShape.oldX + svgShape.oldWidth); if (leftIncluded) { svgShape.width = bounds.width() - svgShape.x - anchorOffset; } else { svgShape.x = bounds.width() - (anchorOffset + svgShape.width); } } else if (!leftIncluded) { svgShape.x = widthDelta * svgShape.oldX; if (!svgShape.isHorizontallyResizable) { svgShape.x = svgShape.x + svgShape.width * widthDelta / 2 - svgShape.width / 2; } } var topIncluded = svgShape.anchorTop; var bottomIncluded = svgShape.anchorBottom; if (bottomIncluded) { anchorOffset = oldBounds.height() - (svgShape.oldY + svgShape.oldHeight); if (topIncluded) { svgShape.height = bounds.height() - svgShape.y - anchorOffset; } else { // Hack for choreography task layouting if (!svgShape._isYLocked) { svgShape.y = bounds.height() - (anchorOffset + svgShape.height); } } } else if (!topIncluded) { svgShape.y = heightDelta * svgShape.oldY; if (!svgShape.isVerticallyResizable) { svgShape.y = svgShape.y + svgShape.height * heightDelta / 2 - svgShape.height / 2; } } }); //check, if the current bounds is unallowed horizontally or vertically resized var p = { x: 0, y: 0 }; if (!this.isHorizontallyResizable && bounds.width() !== oldBounds.width()) { p.x = oldBounds.width() - bounds.width(); } if (!this.isVerticallyResizable && bounds.height() !== oldBounds.height()) { p.y = oldBounds.height() - bounds.height(); } if (p.x !== 0 || p.y !== 0) { bounds.extend(p); } //check, if the current bounds are between maximum and minimum bounds p = { x: 0, y: 0 }; var widthDifference, heightDifference; if (this.minimumSize) { ORYX.Log.debug("Shape (%0)'s min size: (%1x%2)", this, this.minimumSize.width, this.minimumSize.height); widthDifference = this.minimumSize.width - bounds.width(); if (widthDifference > 0) { p.x += widthDifference; } heightDifference = this.minimumSize.height - bounds.height(); if (heightDifference > 0) { p.y += heightDifference; } } if (this.maximumSize) { ORYX.Log.debug("Shape (%0)'s max size: (%1x%2)", this, this.maximumSize.width, this.maximumSize.height); widthDifference = bounds.width() - this.maximumSize.width; if (widthDifference > 0) { p.x -= widthDifference; } heightDifference = bounds.height() - this.maximumSize.height; if (heightDifference > 0) { p.y -= heightDifference; } } if (p.x !== 0 || p.y !== 0) { bounds.extend(p); } //update magnets var widthDelta = bounds.width() / oldBounds.width(); var heightDelta = bounds.height() / oldBounds.height(); var leftIncluded, rightIncluded, topIncluded, bottomIncluded, center, newX, newY; this.magnets.each(function(magnet){ leftIncluded = magnet.anchorLeft; rightIncluded = magnet.anchorRight; topIncluded = magnet.anchorTop; bottomIncluded = magnet.anchorBottom; center = magnet.bounds.center(); if (leftIncluded) { newX = center.x; } else if (rightIncluded) { newX = bounds.width() - (oldBounds.width() - center.x) } else { newX = center.x * widthDelta; } if (topIncluded) { newY = center.y; } else if (bottomIncluded) { newY = bounds.height() - (oldBounds.height() - center.y); } else { newY = center.y * heightDelta; } if (center.x !== newX || center.y !== newY) { magnet.bounds.centerMoveTo(newX, newY); } }); //set new position of labels this.getLabels().each(function(label){ leftIncluded = label.anchorLeft; rightIncluded = label.anchorRight; topIncluded = label.anchorTop; bottomIncluded = label.anchorBottom; if (leftIncluded) { } else if (rightIncluded) { label.x = bounds.width() - (oldBounds.width() - label.oldX) } else { label.x *= widthDelta; } if (topIncluded) { } else if (bottomIncluded) { label.y = bounds.height() - (oldBounds.height() - label.oldY); } else { label.y *= heightDelta; } }); //update docker var docker = this.dockers[0]; if (docker) { docker.bounds.unregisterCallback(this._dockerChangedCallback); if (!this._dockerUpdated) { docker.bounds.centerMoveTo(this.bounds.center()); this._dockerUpdated = false; } docker.update(); docker.bounds.registerCallback(this._dockerChangedCallback); } this.isResized = false; } this.refresh(); this.isChanged = false; this._oldBounds = this.bounds.clone(); } this.children.each(function(value) { if(!(value instanceof ORYX.Core.Controls.Docker)) { value._update(); } }); if (this.dockers.length > 0&&!this.dockers.first().getDockedShape()) { this.dockers.each(function(docker){ docker.bounds.centerMoveTo(this.bounds.center()) }.bind(this)) } /*this.incoming.each((function(edge) { if(!(this.dockers[0] && this.dockers[0].getDockedShape() instanceof ORYX.Core.Node)) edge._update(true); }).bind(this)); this.outgoing.each((function(edge) { if(!(this.dockers[0] && this.dockers[0].getDockedShape() instanceof ORYX.Core.Node)) edge._update(true); }).bind(this)); */ }, /** * This method repositions and resizes the SVG representation * of the shape. */ refresh: function(){ arguments.callee.$.refresh.apply(this, arguments); /** Movement */ var x = this.bounds.upperLeft().x; var y = this.bounds.upperLeft().y; //set translation in transform attribute /*var attributeTransform = document.createAttributeNS(ORYX.CONFIG.NAMESPACE_SVG, "transform"); attributeTransform.nodeValue = "translate(" + x + ", " + y + ")"; this.node.firstChild.setAttributeNode(attributeTransform);*/ // Move owner element this.node.firstChild.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")"); // Move magnets this.node.childNodes[1].childNodes[1].setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")"); /** Resize */ //iterate over all relevant svg elements and update them this._svgShapes.each(function(svgShape){ svgShape.update(); }); }, _dockerChanged: function(){ var docker = this.dockers[0]; //set the bounds of the the association this.bounds.centerMoveTo(docker.bounds.center()); this._dockerUpdated = true; //this._update(true); }, /** * This method traverses a tree of SVGElements and returns * all SVGShape objects. For each basic shape or path element * a SVGShape object is initialized. * * @param svgNode {SVGElement} * @return {Array} Array of SVGShape objects */ _initSVGShapes: function(svgNode){ var svgShapes = []; try { var svgShape = new ORYX.Core.SVG.SVGShape(svgNode); svgShapes.push(svgShape); } catch (e) { //do nothing } if (svgNode.hasChildNodes()) { for (var i = 0; i < svgNode.childNodes.length; i++) { svgShapes = svgShapes.concat(this._initSVGShapes(svgNode.childNodes[i])); } } return svgShapes; }, /** * Calculate if the point is inside the Shape * @param {PointX} * @param {PointY} * @param {absoluteBounds} optional: for performance */ isPointIncluded: function(pointX, pointY, absoluteBounds){ // If there is an arguments with the absoluteBounds var absBounds = absoluteBounds && absoluteBounds instanceof ORYX.Core.Bounds ? absoluteBounds : this.absoluteBounds(); if (!absBounds.isIncluded(pointX, pointY)) { return false; } else { } //point = Object.clone(point); var ul = absBounds.upperLeft(); var x = pointX - ul.x; var y = pointY - ul.y; var i=0; do { var isPointIncluded = this._svgShapes[i++].isPointIncluded( x, y ); } while( !isPointIncluded && i < this._svgShapes.length) return isPointIncluded; /*return this._svgShapes.any(function(svgShape){ return svgShape.isPointIncluded(point); });*/ }, /** * Calculate if the point is over an special offset area * @param {Point} */ isPointOverOffset: function( pointX, pointY ){ var isOverEl = arguments.callee.$.isPointOverOffset.apply( this , arguments ); if (isOverEl) { // If there is an arguments with the absoluteBounds var absBounds = this.absoluteBounds(); absBounds.widen( - ORYX.CONFIG.BORDER_OFFSET ); if ( !absBounds.isIncluded( pointX, pointY )) { return true; } } return false; }, serialize: function(){ var result = arguments.callee.$.serialize.apply(this); // Add the docker's bounds // nodes only have at most one docker! this.dockers.each((function(docker){ if (docker.getDockedShape()) { var center = docker.referencePoint; center = center ? center : docker.bounds.center(); result.push({ name: 'docker', prefix: 'oryx', value: $H(center).values().join(','), type: 'literal' }); } }).bind(this)); // Get the spezific serialized object from the stencil try { //result = this.getStencil().serialize(this, result); var serializeEvent = this.getStencil().serialize(); /* * call serialize callback by reference, result should be found * in serializeEvent.result */ if(serializeEvent.type) { serializeEvent.shape = this; serializeEvent.data = result; serializeEvent.result = undefined; serializeEvent.forceExecution = true; this._delegateEvent(serializeEvent); if(serializeEvent.result) { result = serializeEvent.result; } } } catch (e) { } return result; }, deserialize: function(data){ arguments.callee.$.deserialize.apply(this, [data]); try { //data = this.getStencil().deserialize(this, data); var deserializeEvent = this.getStencil().deserialize(); /* * call serialize callback by reference, result should be found * in serializeEventInfo.result */ if(deserializeEvent.type) { deserializeEvent.shape = this; deserializeEvent.data = data; deserializeEvent.result = undefined; deserializeEvent.forceExecution = true; this._delegateEvent(deserializeEvent); if(deserializeEvent.result) { data = deserializeEvent.result; } } } catch (e) { } // Set the outgoing shapes var outgoing = data.findAll(function(ser){ return (ser.prefix+"-"+ser.name) == 'raziel-outgoing'}); outgoing.each((function(obj){ // TODO: Look at Canvas if(!this.parent) {return}; // Set outgoing Shape var next = this.getCanvas().getChildShapeByResourceId(obj.value); if(next){ if(next instanceof ORYX.Core.Edge) { //Set the first docker of the next shape next.dockers.first().setDockedShape(this); next.dockers.first().setReferencePoint(next.dockers.first().bounds.center()); } else if(next.dockers.length > 0) { //next is a node and next has a docker next.dockers.first().setDockedShape(this); //next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0}); } } }).bind(this)); if (this.dockers.length === 1) { var dockerPos; dockerPos = data.find(function(entry){ return (entry.prefix + "-" + entry.name === "oryx-dockers"); }); if (dockerPos) { var points = dockerPos.value.replace(/,/g, " ").split(" ").without("").without("#"); if (points.length === 2 && this.dockers[0].getDockedShape()) { this.dockers[0].setReferencePoint({ x: parseFloat(points[0]), y: parseFloat(points[1]) }); } else { this.dockers[0].bounds.centerMoveTo(parseFloat(points[0]), parseFloat(points[1])); } } } }, /** * This method excepts the SVGDoucment that is the SVG representation * of this shape. * The bounds of the shape are calculated, the SVG representation's upper left point * is moved to 0,0 and it the method sets if this shape is resizable. * * @param {SVGDocument} svgDocument */ _init: function(svgDocument){ arguments.callee.$._init.apply(this, arguments); var svgNode = svgDocument.getElementsByTagName("g")[0]; //outer most g node // set all required attributes var attributeTitle = svgDocument.ownerDocument.createAttributeNS(null, "title"); attributeTitle.nodeValue = this.getStencil().title(); svgNode.setAttributeNode(attributeTitle); var attributeId = svgDocument.ownerDocument.createAttributeNS(null, "id"); attributeId.nodeValue = this.id; svgNode.setAttributeNode(attributeId); // var stencilTargetNode = this.node.childNodes[0].childNodes[0]; //<g class=me>" svgNode = stencilTargetNode.appendChild(svgNode); // Add to the EventHandler this.addEventHandlers(svgNode); /**set minimum and maximum size*/ var minSizeAttr = svgNode.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "minimumSize"); if (minSizeAttr) { minSizeAttr = minSizeAttr.replace("/,/g", " "); var minSizeValues = minSizeAttr.split(" "); minSizeValues = minSizeValues.without(""); if (minSizeValues.length > 1) { this.minimumSize = { width: parseFloat(minSizeValues[0]), height: parseFloat(minSizeValues[1]) }; } else { //set minimumSize to (1,1), so that width and height of the stencil can never be (0,0) this.minimumSize = { width: 1, height: 1 }; } } var maxSizeAttr = svgNode.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "maximumSize"); if (maxSizeAttr) { maxSizeAttr = maxSizeAttr.replace("/,/g", " "); var maxSizeValues = maxSizeAttr.split(" "); maxSizeValues = maxSizeValues.without(""); if (maxSizeValues.length > 1) { this.maximumSize = { width: parseFloat(maxSizeValues[0]), height: parseFloat(maxSizeValues[1]) }; } } if (this.minimumSize && this.maximumSize && (this.minimumSize.width > this.maximumSize.width || this.minimumSize.height > this.maximumSize.height)) { //TODO wird verschluckt!!! throw this + ": Minimum Size must be greater than maxiumSize."; } /**get current bounds and adjust it to upperLeft == (0,0)*/ //initialize all SVGShape objects this._svgShapes = this._initSVGShapes(svgNode); //get upperLeft and lowerRight of stencil var upperLeft = { x: undefined, y: undefined }; var lowerRight = { x: undefined, y: undefined }; var me = this; this._svgShapes.each(function(svgShape){ upperLeft.x = (upperLeft.x !== undefined) ? Math.min(upperLeft.x, svgShape.x) : svgShape.x; upperLeft.y = (upperLeft.y !== undefined) ? Math.min(upperLeft.y, svgShape.y) : svgShape.y; lowerRight.x = (lowerRight.x !== undefined) ? Math.max(lowerRight.x, svgShape.x + svgShape.width) : svgShape.x + svgShape.width; lowerRight.y = (lowerRight.y !== undefined) ? Math.max(lowerRight.y, svgShape.y + svgShape.height) : svgShape.y + svgShape.height; /** set if resizing is enabled */ //TODO isResizable durch die beiden anderen booleans ersetzen? if (svgShape.isHorizontallyResizable) { me.isHorizontallyResizable = true; me.isResizable = true; } if (svgShape.isVerticallyResizable) { me.isVerticallyResizable = true; me.isResizable = true; } if (svgShape.anchorTop && svgShape.anchorBottom) { me.isVerticallyResizable = true; me.isResizable = true; } if (svgShape.anchorLeft && svgShape.anchorRight) { me.isHorizontallyResizable = true; me.isResizable = true; } }); //move all SVGShapes by -upperLeft this._svgShapes.each(function(svgShape){ svgShape.x -= upperLeft.x; svgShape.y -= upperLeft.y; svgShape.update(); }); //set bounds of shape //the offsets are also needed for positioning the magnets and the docker var offsetX = upperLeft.x; var offsetY = upperLeft.y; lowerRight.x -= offsetX; lowerRight.y -= offsetY; upperLeft.x = 0; upperLeft.y = 0; //prevent that width or height of initial bounds is 0 if (lowerRight.x === 0) { lowerRight.x = 1; } if (lowerRight.y === 0) { lowerRight.y = 1; } this._oldBounds.set(upperLeft, lowerRight); this.bounds.set(upperLeft, lowerRight); /**initialize magnets */ var magnets = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "magnets"); if (magnets && magnets.length > 0) { magnets = $A(magnets[0].getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "magnet")); var me = this; magnets.each(function(magnetElem){ var magnet = new ORYX.Core.Controls.Magnet({ eventHandlerCallback: me.eventHandlerCallback }); var cx = parseFloat(magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cx")); var cy = parseFloat(magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cy")); magnet.bounds.centerMoveTo({ x: cx - offsetX, y: cy - offsetY }); //get anchors var anchors = magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors"); if (anchors) { anchors = anchors.replace("/,/g", " "); anchors = anchors.split(" ").without(""); for(var i = 0; i < anchors.length; i++) { switch(anchors[i].toLowerCase()) { case "left": magnet.anchorLeft = true; break; case "right": magnet.anchorRight = true; break; case "top": magnet.anchorTop = true; break; case "bottom": magnet.anchorBottom = true; break; } } } me.add(magnet); //check, if magnet is default magnet if (!this._defaultMagnet) { var defaultAttr = magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "default"); if (defaultAttr && defaultAttr.toLowerCase() === "yes") { me._defaultMagnet = magnet; } } }); } else { // Add a Magnet in the Center of Shape var magnet = new ORYX.Core.Controls.Magnet(); magnet.bounds.centerMoveTo(this.bounds.width() / 2, this.bounds.height() / 2); this.add(magnet); } /**initialize docker */ var dockerElem = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "docker"); if (dockerElem && dockerElem.length > 0) { dockerElem = dockerElem[0]; var docker = this.createDocker(); var cx = parseFloat(dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cx")); var cy = parseFloat(dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cy")); docker.bounds.centerMoveTo({ x: cx - offsetX, y: cy - offsetY }); //get anchors var anchors = dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors"); if (anchors) { anchors = anchors.replace("/,/g", " "); anchors = anchors.split(" ").without(""); for(var i = 0; i < anchors.length; i++) { switch(anchors[i].toLowerCase()) { case "left": docker.anchorLeft = true; break; case "right": docker.anchorRight = true; break; case "top": docker.anchorTop = true; break; case "bottom": docker.anchorBottom = true; break; } } } } /**initialize labels*/ var textElems = svgNode.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text'); $A(textElems).each((function(textElem){ var label = new ORYX.Core.SVG.Label({ textElement: textElem, shapeId: this.id, eventHandler: this._delegateEvent.bind(this), editable: true }); label.x -= offsetX; label.y -= offsetY; this._labels[label.id] = label; }).bind(this)); }, /** * Override the Method, that a docker is not shown * */ createDocker: function() { var docker = new ORYX.Core.Controls.Docker({eventHandlerCallback: this.eventHandlerCallback}); docker.bounds.registerCallback(this._dockerChangedCallback); this.dockers.push( docker ); docker.parent = this; docker.bounds.registerCallback(this._changedCallback); return docker; }, toString: function(){ return this._stencil.title() + " " + this.id } }; ORYX.Core.Node = ORYX.Core.Shape.extend(ORYX.Core.Node);
08to09-processwave
oryx/editor/client/scripts/Core/node.js
JavaScript
mit
27,651
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ var idCounter = 0; var ID_PREFIX = "resource"; /** * Main initialization method. To be called when loading * of the document, including all scripts, is completed. */ function init() { /* When the blank image url is not set programatically to a local * representation, a spacer gif on the site of ext is loaded from the * internet. This causes problems when internet or the ext site are not * available. */ Ext.BLANK_IMAGE_URL = ORYX.PATH + 'editor/lib/ext-2.0.2/resources/images/default/s.gif'; ORYX.Log.debug("Querying editor instances"); // Hack for WebKit to set the SVGElement-Classes ORYX.Editor.setMissingClasses(); // If someone wants to create the editor instance himself if (window.onOryxResourcesLoaded) { window.onOryxResourcesLoaded(); } // Else if this is a newly created model else if(window.location.pathname.include(ORYX.CONFIG.ORYX_NEW_URL)){ new ORYX.Editor({ id: 'oryx-canvas123', fullscreen: true, stencilset: { url: "/oryx" + ORYX.Utils.getParamFromUrl("stencilset") } }); } // Else fetch the model from server and display editor else { //HACK for distinguishing between different backends // Backend of 2008 uses /self URL ending var modelUrl = window.location.href.replace(/#.*/g, ""); if(modelUrl.endsWith("/self")) { modelUrl = modelUrl.replace("/self","/json"); } else { modelUrl += "&data"; } ORYX.Editor.createByUrl(modelUrl, { id: modelUrl }); } } /** @namespace Global Oryx name space @name ORYX */ if(!ORYX) {var ORYX = {};} /** * The Editor class. * @class ORYX.Editor * @extends Clazz * @param {Object} config An editor object, passed to {@link ORYX.Editor#loadSerialized} * @param {String} config.id Any ID that can be used inside the editor. If fullscreen=false, any HTML node with this id must be present to render the editor to this node. * @param {boolean} [config.fullscreen=true] Render editor in fullscreen mode or not. * @param {String} config.stencilset.url Stencil set URL. * @param {String} [config.stencil.id] Stencil type used for creating the canvas. * @param {Object} config.properties Any properties applied to the canvas. */ ORYX.Editor = { /** @lends ORYX.Editor.prototype */ // Defines the global dom event listener DOMEventListeners: new Hash(), // Defines the selection selection: [], // Defines the current zoom level zoomLevel:1.0, // Id of the local user in collaboration mode userId: undefined, dragging: false, construct: function(config) { // initialization. this._eventsQueue = []; this.loadedPlugins = []; this.pluginsData = []; //meta data about the model for the signavio warehouse //directory, new, name, description, revision, model (the model data) this.modelMetaData = config; var model = config; if(config.model) { model = config.model; } this.id = model.resourceId; if(!this.id) { this.id = model.id; if(!this.id) { this.id = ORYX.Editor.provideId(); } } // Defines if the editor should be fullscreen or not this.fullscreen = model.fullscreen || true; // Initialize the eventlistener this._initEventListener(); // Load particular stencilset var ssUrl; if(ORYX.CONFIG.BACKEND_SWITCH) { ssUrl = (model.stencilset.namespace||model.stencilset.url).replace("#", "%23"); ORYX.Core.StencilSet.loadStencilSet(ORYX.CONFIG.STENCILSET_HANDLER + ssUrl, this.id); } else { ssUrl = model.stencilset.url; ORYX.Core.StencilSet.loadStencilSet(ssUrl, this.id); } //TODO load ealier and asynchronous?? this._loadStencilSetExtensionConfig(); //Load predefined StencilSetExtensions if(!!ORYX.CONFIG.SSEXTS){ ORYX.CONFIG.SSEXTS.each(function(ssext){ this.loadSSExtension(ssext.namespace); }.bind(this)); } // CREATES the canvas this._createCanvas(model.stencil ? model.stencil.id : null, model.properties); // GENERATES the whole EXT.VIEWPORT this._generateGUI(); // Initializing of a callback to check loading ends var loadPluginFinished = false; var loadContentFinished = false; var initFinished = function(){ if( !loadPluginFinished || !loadContentFinished ){ return; } this._finishedLoading(); }.bind(this); // disable key events when Ext modal window is active ORYX.Editor.makeExtModalWindowKeysave(this._getPluginFacade()); // LOAD the plugins window.setTimeout(function(){ this.loadPlugins(); loadPluginFinished = true; initFinished(); }.bind(this), 100); // LOAD the content of the current editor instance window.setTimeout(function(){ this.loadSerialized(model); this.getCanvas().update(); loadContentFinished = true; initFinished(); }.bind(this), 200); this.readOnlyMode = false; this.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange.bind(this)); this.registerOnEvent(ORYX.CONFIG.EVENT_USER_ID_CHANGED, this.handleUserIdChangedEvent.bind(this)); this.registerOnEvent(ORYX.CONFIG.EVENT_DRAGDROP_START, this.handleDragStart.bind(this)); this.registerOnEvent(ORYX.CONFIG.EVENT_DRAGDROP_END, this.handleDragEnd.bind(this)); this.registerOnEvent(ORYX.CONFIG.EVENT_CANVAS_DRAGDROP_LOCK_TOGGLE, this.handleDragDropLockToggle.bind(this)); this.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this.changeMode.bind(this)); // Mode management this.modeManager = new ORYX.Editor.ModeManager(this._getPluginFacade()); }, handleDragStart: function handleDragStart(evt) { this.dragging = true; }, handleDragEnd: function handleDragEnd(evt) { this.dragging = false; }, handleDragDropLockToggle: function handleDragDropLockToggle(evt) { if (evt.lock) { this.dropTarget.lock(); } else { this.dropTarget.unlock(); } }, _finishedLoading: function() { if(Ext.getCmp('oryx-loading-panel')){ Ext.getCmp('oryx-loading-panel').hide(); } // Do Layout for viewport this.layout.doLayout(); // Generate a drop target this.dropTarget = new Ext.dd.DropTarget(this.getCanvas().rootNode.parentNode); // Fixed the problem that the viewport can not // start with collapsed panels correctly if (ORYX.CONFIG.PANEL_RIGHT_COLLAPSED === true){ // east region disabled //this.layout_regions.east.collapse(); } if (ORYX.CONFIG.PANEL_LEFT_COLLAPSED === true){ // west region disabled //this.layout_regions.west.collapse(); } // Raise Loaded Event this.handleEvents( {type:ORYX.CONFIG.EVENT_LOADED} ); }, _initEventListener: function(){ // Register on Events document.documentElement.addEventListener(ORYX.CONFIG.EVENT_KEYDOWN, this.catchKeyDownEvents.bind(this), true); document.documentElement.addEventListener(ORYX.CONFIG.EVENT_KEYUP, this.catchKeyUpEvents.bind(this), true); // Enable Key up and down Event this._keydownEnabled = true; this._keyupEnabled = true; this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEDOWN] = new Array(); this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEUP] = new Array(); this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEOVER] = new Array(); this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEOUT] = new Array(); this.DOMEventListeners[ORYX.CONFIG.EVENT_SELECTION_CHANGED] = new Array(); this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEMOVE] = new Array(); }, /** * Generate the whole viewport of the * Editor and initialized the Ext-Framework * */ _generateGUI: function() { //TODO make the height be read from eRDF data from the canvas. // default, a non-fullscreen editor shall define its height by layout.setHeight(int) // Defines the layout hight if it's NOT fullscreen var layoutHeight = 400; var canvasParent = this.getCanvas().rootNode.parentNode; // DEFINITION OF THE VIEWPORT AREAS this.layout_regions = { // DEFINES TOP-AREA /*north : new Ext.Panel({ //TOOO make a composite of the oryx header and addable elements (for toolbar), second one should contain margins region : 'north', cls : 'x-panel-editor-north', autoEl : 'div', autoWidth: true, border : false }),*/ // DEFINES BOTTOM-AREA south : new Ext.Panel({ region : 'south', cls : 'x-panel-editor-south', autoEl : 'div', border : false }), // DEFINES LEFT-AREA /*west : new Ext.Panel({ region : 'west', layout : 'fit', border : false, autoEl : 'div', cls : 'x-panel-editor-west', collapsible : false, width : ORYX.CONFIG.PANEL_LEFT_WIDTH || 60, autoScroll:true, cmargins: {left:0, right:0}, split : false, header : false }),*/ // DEFINES CENTER-AREA (FOR THE EDITOR) center : new Ext.Panel({ id : 'oryx_center_region', region : 'center', cls : 'x-panel-editor-center', border : false, autoScroll: true, items : { layout : "fit", autoHeight: true, el : canvasParent } }) }; // Config for the Ext.Viewport var layout_config = { layout: 'border', items: [ // north disabled //this.layout_regions.north, // east disabled //this.layout_regions.east, this.layout_regions.south, // west disabled //this.layout_regions.west, this.layout_regions.center ] }; // IF Fullscreen, use a viewport if (this.fullscreen) { this.layout = new Ext.Viewport( layout_config ); // IF NOT, use a panel and render it to the given id } else { layout_config.renderTo = this.id; layout_config.height = layoutHeight; this.layout = new Ext.Panel( layout_config ); } // Set the editor to the center, and refresh the size canvasParent.setAttributeNS(null, 'align', 'left'); canvasParent.parentNode.setAttributeNS(null, 'align', 'center'); canvasParent.parentNode.setAttributeNS(null, 'style', "overflow: scroll;" + "background-color: lightgrey;" + "background: -moz-linear-gradient(center top , #7B7778, #7D797A) repeat scroll 0 0 transparent;" + "background: -webkit-gradient(linear, left top, left bottom, from(#7B7778), to(#7D797A));" ); this.getCanvas().setSize({ width : ORYX.CONFIG.CANVAS_WIDTH, height : ORYX.CONFIG.CANVAS_HEIGHT }); }, /** * adds a component to the specified region * * @param {String} region * @param {Ext.Component} component * @param {String} title, optional * @return {Ext.Component} dom reference to the current region or null if specified region is unknown */ addToRegion: function(region, component, title) { if (region.toLowerCase && this.layout_regions[region.toLowerCase()]) { var current_region = this.layout_regions[region.toLowerCase()]; current_region.add(component); /*if( (region.toLowerCase() == 'east' || region.toLowerCase() == 'west') && current_region.items.length == 2){ //!current_region.getLayout() instanceof Ext.layout.Accordion ){ var layout = new Ext.layout.Accordion( current_region.layoutConfig ); current_region.setLayout( layout ); var items = current_region.items.clone(); current_region.items.each(function(item){ current_region.remove( item )}) items.each(function(item){ current_region.add( item )}) } */ ORYX.Log.debug("original dimensions of region %0: %1 x %2", current_region.region, current_region.width, current_region.height); // update dimensions of region if required. if (!current_region.width && component.initialConfig && component.initialConfig.width) { ORYX.Log.debug("resizing width of region %0: %1", current_region.region, component.initialConfig.width); current_region.setWidth(component.initialConfig.width); } if (component.initialConfig && component.initialConfig.height) { ORYX.Log.debug("resizing height of region %0: %1", current_region.region, component.initialConfig.height); var current_height = current_region.height || 0; current_region.height = component.initialConfig.height + current_height; current_region.setHeight(component.initialConfig.height + current_height); } // set title if provided as parameter. if (typeof title == "string") { current_region.setTitle(title); } // trigger doLayout() and show the pane current_region.ownerCt.doLayout(); current_region.show(); if(Ext.isMac) ORYX.Editor.resizeFix(); return current_region; } return null; }, getAvailablePlugins: function(){ var curAvailablePlugins=ORYX.availablePlugins.clone(); curAvailablePlugins.each(function(plugin){ if(this.loadedPlugins.find(function(loadedPlugin){ return loadedPlugin.type==this.name; }.bind(plugin))){ plugin.engaged=true; }else{ plugin.engaged=false; } }.bind(this)); return curAvailablePlugins; }, loadScript: function (url, callback){ var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); }, /** * activate Plugin * * @param {String} name * @param {Function} callback * callback(sucess, [errorCode]) * errorCodes: NOTUSEINSTENCILSET, REQUIRESTENCILSET, NOTFOUND, YETACTIVATED */ activatePluginByName: function(name, callback, loadTry){ var match=this.getAvailablePlugins().find(function(value){return value.name==name;}); if(match && (!match.engaged || (match.engaged==='false'))){ var loadedStencilSetsNamespaces = this.getStencilSets().keys(); var facade = this._getPluginFacade(); var newPlugin; var me=this; ORYX.Log.debug("Initializing plugin '%0'", match.name); if (!match.requires || !match.requires.namespaces || match.requires.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) ){ if(!match.notUsesIn || !match.notUsesIn.namespaces || !match.notUsesIn.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; })){ try { var className = eval(match.name); newPlugin = new className(facade, match); newPlugin.type = match.name; // If there is an GUI-Plugin, they get all Plugins-Offer-Meta-Data if (newPlugin.registryChanged) newPlugin.registryChanged(me.pluginsData); // If there have an onSelection-Method it will pushed to the Editor Event-Handler if (newPlugin.onSelectionChanged) me.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, newPlugin.onSelectionChanged.bind(newPlugin)); this.loadedPlugins.push(newPlugin); this.loadedPlugins.each(function(loaded){ if(loaded.registryChanged) loaded.registryChanged(this.pluginsData); }.bind(me)); callback(true); } catch(e) { ORYX.Log.warn("Plugin %0 is not available", match.name); if(!!loadTry){ callback(false,"INITFAILED"); return; } this.loadScript("plugins/scripts/"+match.source, this.activatePluginByName.bind(this,match.name,callback,true)); } }else{ callback(false,"NOTUSEINSTENCILSET"); ORYX.Log.info("Plugin need a stencilset which is not loaded'", match.name); } } else { callback(false,"REQUIRESTENCILSET"); ORYX.Log.info("Plugin need a stencilset which is not loaded'", match.name); } }else{ callback(false, match?"NOTFOUND":"YETACTIVATED"); //TODO error handling } }, /** * Laden der Plugins */ loadPlugins: function() { // if there should be plugins but still are none, try again. // TODO this should wait for every plugin respectively. /*if (!ORYX.Plugins && ORYX.availablePlugins.length > 0) { window.setTimeout(this.loadPlugins.bind(this), 100); return; }*/ var me = this; var newPlugins = []; var loadedStencilSetsNamespaces = this.getStencilSets().keys(); // Available Plugins will be initalize var facade = this._getPluginFacade(); // If there is an Array where all plugins are described, than only take those // (that comes from the usage of oryx with a mashup api) if( ORYX.MashupAPI && ORYX.MashupAPI.loadablePlugins && ORYX.MashupAPI.loadablePlugins instanceof Array ){ // Get the plugins from the available plugins (those who are in the plugins.xml) ORYX.availablePlugins = $A(ORYX.availablePlugins).findAll(function(value){ return ORYX.MashupAPI.loadablePlugins.include( value.name ); }); // Add those plugins to the list, which are only in the loadablePlugins list ORYX.MashupAPI.loadablePlugins.each(function( className ){ if( !(ORYX.availablePlugins.find(function(val){ return val.name == className; }))){ ORYX.availablePlugins.push( {name: className } ); } }); } ORYX.availablePlugins.each(function(value) { ORYX.Log.debug("Initializing plugin '%0'", value.name); if( (!value.requires || !value.requires.namespaces || value.requires.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) ) && (!value.notUsesIn || !value.notUsesIn.namespaces || !value.notUsesIn.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) )&& /*only load activated plugins or undefined */ (value.engaged || (value.engaged===undefined)) ){ try { var className = eval(value.name); if( className ){ var plugin = new className(facade, value); plugin.type = value.name; newPlugins.push( plugin ); plugin.engaged=true; } } catch(e) { ORYX.Log.warn("Plugin %0 threw the following exception: %1", value.name, e); ORYX.Log.warn("Plugin %0 is not available", value.name); } } else { ORYX.Log.info("Plugin need a stencilset which is not loaded'", value.name); } }); newPlugins.each(function(value) { // If there is an GUI-Plugin, they get all Plugins-Offer-Meta-Data if(value.registryChanged) value.registryChanged(me.pluginsData); // If there have an onSelection-Method it will pushed to the Editor Event-Handler if(value.onSelectionChanged) me.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, value.onSelectionChanged.bind(value)); }); this.loadedPlugins = newPlugins; // Hack for the Scrollbars if(Ext.isMac) { ORYX.Editor.resizeFix(); } this.registerPluginsOnKeyEvents(); this.setSelection(); }, /** * Loads the stencil set extension file, defined in ORYX.CONFIG.SS_EXTENSIONS_CONFIG */ _loadStencilSetExtensionConfig: function(){ // load ss extensions new Ajax.Request(ORYX.CONFIG.SS_EXTENSIONS_CONFIG, { method: 'GET', asynchronous: false, onSuccess: (function(transport) { var jsonObject = Ext.decode(transport.responseText); this.ss_extensions_def = jsonObject; }).bind(this), onFailure: (function(transport) { ORYX.Log.error("Editor._loadStencilSetExtensionConfig: Loading stencil set extension configuration file failed." + transport); }).bind(this) }); }, /** * Creates the Canvas * @param {String} [stencilType] The stencil type used for creating the canvas. If not given, a stencil with myBeRoot = true from current stencil set is taken. * @param {Object} [canvasConfig] Any canvas properties (like language). */ _createCanvas: function(stencilType, canvasConfig) { if (stencilType) { // Add namespace to stencilType if (stencilType.search(/^http/) === -1) { stencilType = this.getStencilSets().values()[0].namespace() + stencilType; } } else { // Get any root stencil type stencilType = this.getStencilSets().values()[0].findRootStencilName(); } // get the stencil associated with the type var canvasStencil = ORYX.Core.StencilSet.stencil(stencilType); if (!canvasStencil) ORYX.Log.fatal("Initialisation failed, because the stencil with the type %0 is not part of one of the loaded stencil sets.", stencilType); // create all dom // TODO fix border, so the visible canvas has a double border and some spacing to the scrollbars var div = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", null, ['div']); // set class for custom styling div.addClassName("ORYX_Editor"); // create the canvas this._canvas = new ORYX.Core.Canvas({ width : ORYX.CONFIG.CANVAS_WIDTH, height : ORYX.CONFIG.CANVAS_HEIGHT, 'eventHandlerCallback' : this.handleEvents.bind(this), id : this.id, parentNode : div }, canvasStencil); if (canvasConfig) { // Migrate canvasConfig to an RDF-like structure //FIXME this isn't nice at all because we don't want rdf any longer var properties = []; for(field in canvasConfig){ properties.push({ prefix: 'oryx', name: field, value: canvasConfig[field] }); } this._canvas.deserialize(properties); } }, /** * Returns a per-editor singleton plugin facade. * To be used in plugin initialization. */ _getPluginFacade: function() { // if there is no pluginfacade already created: if(!(this._pluginFacade)) // create it. this._pluginFacade = { activatePluginByName: this.activatePluginByName.bind(this), //deactivatePluginByName: this.deactivatePluginByName.bind(this), getAvailablePlugins: this.getAvailablePlugins.bind(this), offer: this.offer.bind(this), getStencilSets: this.getStencilSets.bind(this), getRules: this.getRules.bind(this), loadStencilSet: this.loadStencilSet.bind(this), createShape: this.createShape.bind(this), deleteShape: this.deleteShape.bind(this), getSelection: this.getSelection.bind(this), setSelection: this.setSelection.bind(this), updateSelection: this.updateSelection.bind(this), getCanvas: this.getCanvas.bind(this), importJSON: this.importJSON.bind(this), importERDF: this.importERDF.bind(this), getERDF: this.getERDF.bind(this), getJSON: this.getJSON.bind(this), getSerializedJSON: this.getSerializedJSON.bind(this), executeCommands: this.executeCommands.bind(this), rollbackCommands: this.rollbackCommands.bind(this), registerOnEvent: this.registerOnEvent.bind(this), unregisterOnEvent: this.unregisterOnEvent.bind(this), raiseEvent: this.handleEvents.bind(this), enableEvent: this.enableEvent.bind(this), disableEvent: this.disableEvent.bind(this), eventCoordinates: this.eventCoordinates.bind(this), addToRegion: this.addToRegion.bind(this), getModelMetaData: this.getModelMetaData.bind(this), getUserId: this.getUserId.bind(this), isDragging: this.isDragging.bind(this), loadSerialized: this.loadSerialized.bind(this), isReadOnlyMode: this.isReadOnlyMode.bind(this) }; return this._pluginFacade; }, handleUserIdChangedEvent: function handleUserIdChangedEvent(event) { this.userId = event.userId; }, getUserId: function getUserId() { return this.userId; }, isDragging: function isDragging() { return this.dragging; }, /** * Sets the editor in read only mode: Edges/ dockers cannot be moved anymore, * shapes cannot be selected anymore. * @methodOf ORYX.Plugins.AbstractPlugin.prototype */ _stopSelectionChange: function() { if (this.isReadOnlyMode() && this.getSelection().length > 0) { this.setSelection([], undefined, undefined, true); } }, enableReadOnlyMode: function() { if (!this.readOnlyMode) { //Edges cannot be moved anymore this.disableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN); this.disableEvent(ORYX.CONFIG.EVENT_MOUSEOVER); this.disableEvent(ORYX.CONFIG.EVENT_DBLCLICK); this.disableEvent(ORYX.CONFIG.EVENT_LABEL_DBLCLICK); this.setSelection([], undefined, undefined, true); } this.readOnlyMode = true; }, /** * Disables read only mode, see @see * @methodOf ORYX.Plugins.AbstractPlugin.prototype * @see ORYX.Plugins.AbstractPlugin.prototype.enableReadOnlyMode */ disableReadOnlyMode: function() { if (this.readOnlyMode) { // Edges can be moved now again this.enableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN); this.enableEvent(ORYX.CONFIG.EVENT_MOUSEOVER); this.enableEvent(ORYX.CONFIG.EVENT_DBLCLICK); this.enableEvent(ORYX.CONFIG.EVENT_LABEL_DBLCLICK); } this.readOnlyMode = false; }, isReadOnlyMode: function isReadOnlyMode() { return this.readOnlyMode; }, /** * Implementes the command pattern * (The real usage of the command pattern * is implemented and shown in the Plugins/undo.js) * * @param <Oryx.Core.Command>[] Array of commands */ executeCommands: function executeCommands(commands) { // Check if the argument is an array and the elements are from command-class if (commands instanceof Array && commands.length > 0 && commands.all(function(command) { return command instanceof ORYX.Core.AbstractCommand; })) { // Raise event for executing commands this.handleEvents({ type: ORYX.CONFIG.EVENT_EXECUTE_COMMANDS, commands: commands, forceExecution: true }); // Execute every command commands.each(function(command) { command.execute(); }); this.handleEvents({ type: ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED, commands: commands, forceExecution: true }); } }, rollbackCommands: function rollbackCommands(commands) { // Check if the argument is an array and the elements are from command-class if (commands instanceof Array && commands.length > 0 && commands.all(function(command) { return command instanceof ORYX.Core.AbstractCommand; })) { // Rollback every command commands.each(function(command) { command.rollback(); }); // Raise event for rollbacking commands this.handleEvents({ type: ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK, commands: commands, forceExecution: true }); } }, /** * Returns JSON of underlying canvas (calls ORYX.Canvas#toJSON()). * @return {Object} Returns JSON representation as JSON object. */ getJSON: function(){ var canvas = this.getCanvas().toJSON(); canvas.ssextensions = this.getStencilSets().values()[0].extensions().keys(); return canvas; }, /** * Serializes a call to toJSON(). * @return {String} Returns JSON representation as string. */ getSerializedJSON: function(){ return Ext.encode(this.getJSON()); }, /** * @return {String} Returns eRDF representation. * @deprecated Use ORYX.Editor#getJSON instead, if possible. */ getERDF:function(){ // Get the serialized dom var serializedDOM = DataManager.serializeDOM( this._getPluginFacade() ); // Add xml definition if there is no serializedDOM = '<?xml version="1.0" encoding="utf-8"?>' + '<html xmlns="http://www.w3.org/1999/xhtml" ' + 'xmlns:b3mn="http://b3mn.org/2007/b3mn" ' + 'xmlns:ext="http://b3mn.org/2007/ext" ' + 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ' + 'xmlns:atom="http://b3mn.org/2007/atom+xhtml">' + '<head profile="http://purl.org/NET/erdf/profile">' + '<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />' + '<link rel="schema.dcTerms" href="http://purl.org/dc/terms/ " />' + '<link rel="schema.b3mn" href="http://b3mn.org" />' + '<link rel="schema.oryx" href="http://oryx-editor.org/" />' + '<link rel="schema.raziel" href="http://raziel.org/" />' + '<base href="' + location.href.split("?")[0] + '" />' + '</head><body>' + serializedDOM + '</body></html>'; return serializedDOM; }, /** * Imports shapes in JSON as expected by {@link ORYX.Editor#loadSerialized} * @param {Object|String} jsonObject The (serialized) json object to be imported * @param {boolean } [noSelectionAfterImport=false] Set to true if no shapes should be selected after import * @throws {SyntaxError} If the serialized json object contains syntax errors */ importJSON: function(jsonObject, noSelectionAfterImport) { try { jsonObject = this.renewResourceIds(jsonObject); } catch(error){ throw error; } //check, if the imported json model can be loaded in this editor // (stencil set has to fit) if(jsonObject.stencilset.namespace && jsonObject.stencilset.namespace !== this.getCanvas().getStencil().stencilSet().namespace()) { Ext.Msg.alert(ORYX.I18N.JSONImport.title, String.format(ORYX.I18N.JSONImport.wrongSS, jsonObject.stencilset.namespace, this.getCanvas().getStencil().stencilSet().namespace())); return null; } else { var command = new ORYX.Core.Commands["Main.JsonImport"](jsonObject, this.loadSerialized.bind(this), noSelectionAfterImport, this._getPluginFacade()); this.executeCommands([command]); return command.shapes.clone(); } }, /** * This method renew all resource Ids and according references. * Warning: The implementation performs a substitution on the serialized object for * easier implementation. This results in a low performance which is acceptable if this * is only used when importing models. * @param {Object|String} jsonObject * @throws {SyntaxError} If the serialized json object contains syntax errors. * @return {Object} The jsonObject with renewed ids. * @private */ renewResourceIds: function(jsonObject){ // For renewing resource ids, a serialized and object version is needed var serJsonObject; if(Ext.type(jsonObject) === "string"){ try { serJsonObject = jsonObject; jsonObject = Ext.decode(jsonObject); } catch(error){ throw new SyntaxError(error.message); } } else { serJsonObject = Ext.encode(jsonObject); } // collect all resourceIds recursively var collectResourceIds = function(shapes){ if(!shapes) return []; return shapes.map(function(shape){ var ids = shape.dockers.map(function(docker) { return docker.id; }); ids.push(shape.resourceId); return collectResourceIds(shape.childShapes).concat(ids); }).flatten(); }; var resourceIds = collectResourceIds(jsonObject.childShapes); // Replace each resource id by a new one resourceIds.each(function(oldResourceId){ var newResourceId = ORYX.Editor.provideId(); serJsonObject = serJsonObject.gsub('"'+oldResourceId+'"', '"'+newResourceId+'"'); }); return Ext.decode(serJsonObject); }, /** * Import erdf structure to the editor * */ importERDF: function( erdfDOM ){ var serialized = this.parseToSerializeObjects( erdfDOM ); if(serialized) return this.importJSON(serialized, true); }, /** * Parses one model (eRDF) to the serialized form (JSON) * * @param {Object} oneProcessData * @return {Object} The JSON form of given eRDF model, or null if it couldn't be extracted */ parseToSerializeObjects: function( oneProcessData ){ // Firefox splits a long text node into chunks of 4096 characters. // To prevent truncation of long property values the normalize method must be called if(oneProcessData.normalize) oneProcessData.normalize(); var serialized_rdf; try { var xsl = ""; var source=ORYX.PATH + "lib/extract-rdf.xsl"; new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: function(transport){ xsl = transport.responseText; }.bind(this), onFailure: (function(transport){ ORYX.Log.error("XSL load failed" + transport); }).bind(this) }); var domParser = new DOMParser(); var xmlObject = oneProcessData; var xslObject = domParser.parseFromString(xsl, "text/xml"); var xsltProcessor = new XSLTProcessor(); var xslRef = document.implementation.createDocument("", "", null); xsltProcessor.importStylesheet(xslObject); var new_rdf = xsltProcessor.transformToFragment(xmlObject, document); serialized_rdf = (new XMLSerializer()).serializeToString(new_rdf); }catch(e){ Ext.Msg.alert("Oryx", error); serialized_rdf = ""; } // Firefox 2 to 3 problem?! serialized_rdf = !serialized_rdf.startsWith("<?xml") ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + serialized_rdf : serialized_rdf; var req = new Ajax.Request(ORYX.CONFIG.ROOT_PATH+"rdf2json", { method: 'POST', asynchronous: false, onSuccess: function(transport) { Ext.decode(transport.responseText); }, parameters: { rdf: serialized_rdf } }); return Ext.decode(req.transport.responseText); }, /** * Loads serialized model to the oryx. * @example * editor.loadSerialized({ * resourceId: "mymodel1", * childShapes: [ * { * stencil:{ id:"Subprocess" }, * outgoing:[{resourceId: 'aShape'}], * target: {resourceId: 'aShape'}, * bounds:{ lowerRight:{ y:510, x:633 }, upperLeft:{ y:146, x:210 } }, * resourceId: "myshape1", * childShapes:[], * properties:{}, * } * ], * properties:{ * language: "English" * }, * stencilset:{ * url:"http://localhost:8080/oryx/stencilsets/bpmn1.1/bpmn1.1.json" * }, * stencil:{ * id:"BPMNDiagram" * } * }); * @param {Object} model Description of the model to load. * @param {Array} [model.ssextensions] List of stenctil set extensions. * @param {String} model.stencilset.url * @param {String} model.stencil.id * @param {Array} model.childShapes * @param {Array} [model.properties] * @param {String} model.resourceId * @return {ORYX.Core.Shape[]} List of created shapes * @methodOf ORYX.Editor.prototype */ loadSerialized: function( model ){ var canvas = this.getCanvas(); // Bugfix (cf. http://code.google.com/p/oryx-editor/issues/detail?id=240) // Deserialize the canvas' stencil set extensions properties first! this.loadSSExtensions(model.ssextensions); var shapes = this.getCanvas().addShapeObjects(model.childShapes, this.handleEvents.bind(this)); if(model.properties) { for(key in model.properties) { var prop = model.properties[key]; if (!(typeof prop === "string")) { prop = Ext.encode(prop); } this.getCanvas().setProperty("oryx-" + key, prop); } } this.getCanvas().updateSize(); return shapes; }, /** * Calls ORYX.Editor.prototype.ss_extension_namespace for each element * @param {Array} ss_extension_namespaces An array of stencil set extension namespaces. */ loadSSExtensions: function(ss_extension_namespaces){ if(!ss_extension_namespaces) return; ss_extension_namespaces.each(function(ss_extension_namespace){ this.loadSSExtension(ss_extension_namespace); }.bind(this)); }, /** * Loads a stencil set extension. * The stencil set extensions definiton file must already * be loaded when the editor is initialized. */ loadSSExtension: function(ss_extension_namespace) { if (this.ss_extensions_def) { var extension = this.ss_extensions_def.extensions.find(function(ex){ return (ex.namespace == ss_extension_namespace); }); if (!extension) { return; } var stencilset = this.getStencilSets()[extension["extends"]]; if (!stencilset) { return; } stencilset.addExtension(ORYX.CONFIG.SS_EXTENSIONS_FOLDER + extension["definition"]); //stencilset.addExtension("/oryx/build/stencilsets/extensions/" + extension["definition"]) this.getRules().initializeRules(stencilset); this._getPluginFacade().raiseEvent({ type: ORYX.CONFIG.EVENT_STENCIL_SET_LOADED }); } }, disableEvent: function(eventType){ if(eventType == ORYX.CONFIG.EVENT_KEYDOWN) { this._keydownEnabled = false; } if(eventType == ORYX.CONFIG.EVENT_KEYUP) { this._keyupEnabled = false; } if(this.DOMEventListeners.keys().member(eventType)) { var value = this.DOMEventListeners.remove(eventType); this.DOMEventListeners['disable_' + eventType] = value; } }, enableEvent: function(eventType){ if(eventType == ORYX.CONFIG.EVENT_KEYDOWN) { this._keydownEnabled = true; } if(eventType == ORYX.CONFIG.EVENT_KEYUP) { this._keyupEnabled = true; } if(this.DOMEventListeners.keys().member("disable_" + eventType)) { var value = this.DOMEventListeners.remove("disable_" + eventType); this.DOMEventListeners[eventType] = value; } }, /** * Methods for the PluginFacade */ registerOnEvent: function(eventType, callback) { if(!(this.DOMEventListeners.keys().member(eventType))) { this.DOMEventListeners[eventType] = []; } this.DOMEventListeners[eventType].push(callback); }, unregisterOnEvent: function(eventType, callback) { if(this.DOMEventListeners.keys().member(eventType)) { this.DOMEventListeners[eventType] = this.DOMEventListeners[eventType].without(callback); } else { // Event is not supported // TODO: Error Handling } }, getSelection: function() { return this.selection; }, getStencilSets: function() { return ORYX.Core.StencilSet.stencilSets(this.id); }, getRules: function() { return ORYX.Core.StencilSet.rules(this.id); }, loadStencilSet: function(source) { try { ORYX.Core.StencilSet.loadStencilSet(source, this.id); this.handleEvents({type:ORYX.CONFIG.EVENT_STENCIL_SET_LOADED}); } catch (e) { ORYX.Log.warn("Requesting stencil set file failed. (" + e + ")"); } }, offer: function(pluginData) { if(!this.pluginsData.member(pluginData)){ this.pluginsData.push(pluginData); } }, /** * It creates an new event or adds the callback, if already existing, * for the key combination that the plugin passes in keyCodes attribute * of the offer method. * * The new key down event fits the schema: * key.event[.metactrl][.alt][.shift].'thekeyCode' */ registerPluginsOnKeyEvents: function() { this.pluginsData.each(function(pluginData) { if(pluginData.keyCodes) { pluginData.keyCodes.each(function(keyComb) { var eventName = "key.event"; /* Include key action */ eventName += '.' + keyComb.keyAction; if(keyComb.metaKeys) { /* Register on ctrl or apple meta key as meta key */ if(keyComb.metaKeys. indexOf(ORYX.CONFIG.META_KEY_META_CTRL) > -1) { eventName += "." + ORYX.CONFIG.META_KEY_META_CTRL; } /* Register on alt key as meta key */ if(keyComb.metaKeys. indexOf(ORYX.CONFIG.META_KEY_ALT) > -1) { eventName += '.' + ORYX.CONFIG.META_KEY_ALT; } /* Register on shift key as meta key */ if(keyComb.metaKeys. indexOf(ORYX.CONFIG.META_KEY_SHIFT) > -1) { eventName += '.' + ORYX.CONFIG.META_KEY_SHIFT; } } /* Register on the actual key */ if(keyComb.keyCode) { eventName += '.' + keyComb.keyCode; } /* Register the event */ ORYX.Log.debug("Register Plugin on Key Event: %0", eventName); this.registerOnEvent(eventName, function(event) { if (typeof pluginData.isEnabled === "undefined" || pluginData.isEnabled()) { pluginData.functionality(event); } }); }.bind(this)); } }.bind(this)); }, setSelection: function(elements, subSelectionElement, force, isLocal) { if (!elements) { elements = []; } elements = elements.compact().findAll(function(n){ return n instanceof ORYX.Core.Shape; }); if (elements.first() instanceof ORYX.Core.Canvas) { elements = []; } // this leads to behaviour where you change a property of the canvas, but cannot accept the change by clicking on the canvas /*if (!force && elements.length === this.selection.length && this.selection.all(function(r){ return elements.include(r); })){ return; }*/ this.selection = elements; this._subSelection = subSelectionElement; this.handleEvents({type: ORYX.CONFIG.EVENT_SELECTION_CHANGED, elements: elements, subSelection: subSelectionElement, isLocal: isLocal}); }, updateSelection: function updateSelection(isLocal) { if (!this.dragging || isLocal) { this.setSelection(this.selection, this._subSelection, true, isLocal); } }, getCanvas: function() { return this._canvas; }, /** * option = { * type: string, * position: {x:int, y:int}, * connectingType: uiObj-Class * connectedShape: uiObj * draggin: bool * namespace: url * parent: ORYX.Core.AbstractShape * template: a template shape that the newly created inherits properties from. * } */ createShape: function(option) { var shouldUpdateSelection = true; var newShapeOptions = {'eventHandlerCallback':this.handleEvents.bind(this)}; if(typeof(option.shapeOptions) !== 'undefined' && typeof(option.shapeOptions.id) !== 'undefined' && typeof(option.shapeOptions.resourceId) !== 'undefined') { // The wave plugin passes an id and resourceId so these are the same on all wave participants. newShapeOptions.id = option.shapeOptions.id; newShapeOptions.resourceId = option.shapeOptions.resourceId; shouldUpdateSelection = false; } var newShapeObject; if (option && option.serialize && option.serialize instanceof Array) { var type = option.serialize.find(function(obj){return (obj.prefix+"-"+obj.name) == "oryx-type";}); var stencil = ORYX.Core.StencilSet.stencil(type.value); newShapeObject = (stencil.type() == 'node') ? new ORYX.Core.Node(newShapeOptions, stencil) : new ORYX.Core.Edge(newShapeOptions, stencil); this.getCanvas().add(newShapeObject); newShapeObject.deserialize(option.serialize); return newShapeObject; } // If there is no argument, throw an exception if (!option || !option.type || !option.namespace) { throw "To create a new shape you have to give an argument with type and namespace";} var canvas = this.getCanvas(); // Get the shape type var shapetype = option.type; // Get the stencil set var sset = ORYX.Core.StencilSet.stencilSet(option.namespace); // Create an New Shape, dependents on an Edge or a Node if(sset.stencil(shapetype).type() == "node") { newShapeObject = new ORYX.Core.Node(newShapeOptions, sset.stencil(shapetype)); } else { newShapeObject = new ORYX.Core.Edge(newShapeOptions, sset.stencil(shapetype)); } // when there is a template, inherit the properties. if(option.template) { newShapeObject._jsonStencil.properties = option.template._jsonStencil.properties; newShapeObject.postProcessProperties(); } // Add to the canvas if(option.parent && newShapeObject instanceof ORYX.Core.Node) { option.parent.add(newShapeObject); } else { canvas.add(newShapeObject); } // Set the position var point = option.position ? option.position : {x:100, y:200}; var con; // If there is create a shape and in the argument there is given an ConnectingType and is instance of an edge if(option.connectingType && option.connectedShape && !(newShapeObject instanceof ORYX.Core.Edge)) { /** * The resourceId of the connecting edge should be inferable from the resourceId of the node for Wave * serialization. If the command was received remotely, id and resourceId for newShapeObject were passed in the * options. If the command has been created locally, id and resourceId for newShapeObject will be serialized * with the command. */ newShapeOptions.id = newShapeObject.id + "_edge"; newShapeOptions.resourceId = newShapeObject.resourceId + "_edge"; con = new ORYX.Core.Edge(newShapeOptions, sset.stencil(option.connectingType)); // And both endings dockers will be referenced to the both shapes con.dockers.first().setDockedShape(option.connectedShape); var magnet = option.connectedShape.getDefaultMagnet(); var cPoint = magnet ? magnet.bounds.center() : option.connectedShape.bounds.midPoint(); con.dockers.first().setReferencePoint( cPoint ); con.dockers.last().setDockedShape(newShapeObject); con.dockers.last().setReferencePoint(newShapeObject.getDefaultMagnet().bounds.center()); // The Edge will be added to the canvas and be updated canvas.add(con); //con.update(); } // Move the new Shape to the position if(newShapeObject instanceof ORYX.Core.Edge && option.connectedShape) { newShapeObject.dockers.first().setDockedShape(option.connectedShape); if( option.connectedShape instanceof ORYX.Core.Node ){ newShapeObject.dockers.first().setReferencePoint(option.connectedShape.getDefaultMagnet().bounds.center()); newShapeObject.dockers.last().bounds.centerMoveTo(point); } else { newShapeObject.dockers.first().setReferencePoint(option.connectedShape.bounds.midPoint()); } } else { var b = newShapeObject.bounds; if( newShapeObject instanceof ORYX.Core.Node && newShapeObject.dockers.length == 1){ b = newShapeObject.dockers.first().bounds; } b.centerMoveTo(point); var upL = b.upperLeft(); b.moveBy( -Math.min(upL.x, 0) , -Math.min(upL.y, 0) ); var lwR = b.lowerRight(); b.moveBy( -Math.max(lwR.x-canvas.bounds.width(), 0) , -Math.max(lwR.y-canvas.bounds.height(), 0) ); } // Update the shape if (newShapeObject instanceof ORYX.Core.Edge) { newShapeObject._update(false); } // And refresh the selection if the command was not created by a remote Wave client if(!(newShapeObject instanceof ORYX.Core.Edge) && shouldUpdateSelection) { this.setSelection([newShapeObject]); } if(con && con.alignDockers) { con.alignDockers(); } if(newShapeObject.alignDockers) { newShapeObject.alignDockers(); } return newShapeObject; }, deleteShape: function(shape) { if (!shape || !shape.parent) { return; } //remove shape from parent // this also removes it from DOM shape.parent.remove(shape); //delete references to outgoing edges shape.getOutgoingShapes().each(function(os) { var docker = os.getDockers().first(); if(docker && docker.getDockedShape() == shape) { docker.setDockedShape(undefined); } }); //delete references to incoming edges shape.getIncomingShapes().each(function(is) { var docker = is.getDockers().last(); if(docker && docker.getDockedShape() == shape) { docker.setDockedShape(undefined); } }); //delete references of the shape's dockers shape.getDockers().each(function(docker) { docker.setDockedShape(undefined); }); }, /** * Returns an object with meta data about the model. * Like name, description, ... * * Empty object with the current backend. * * @return {Object} Meta data about the model */ getModelMetaData: function() { return this.modelMetaData; }, /* Event-Handler Methods */ /** * Helper method to execute an event immediately. The event is not * scheduled in the _eventsQueue. Needed to handle Layout-Callbacks. */ _executeEventImmediately: function(eventObj) { if(this.DOMEventListeners.keys().member(eventObj.event.type)) { this.DOMEventListeners[eventObj.event.type].each((function(value) { value(eventObj.event, eventObj.arg); }).bind(this)); } }, _executeEvents: function() { this._queueRunning = true; while(this._eventsQueue.length > 0) { var val = this._eventsQueue.shift(); this._executeEventImmediately(val); } this._queueRunning = false; }, /** * Leitet die Events an die Editor-Spezifischen Event-Methoden weiter * @param {Object} event Event , welches gefeuert wurde * @param {Object} uiObj Target-UiObj */ handleEvents: function(event, uiObj) { ORYX.Log.trace("Dispatching event type %0 on %1", event.type, uiObj); switch(event.type) { case ORYX.CONFIG.EVENT_MOUSEDOWN: this._handleMouseDown(event, uiObj); break; case ORYX.CONFIG.EVENT_MOUSEMOVE: this._handleMouseMove(event, uiObj); break; case ORYX.CONFIG.EVENT_MOUSEUP: this._handleMouseUp(event, uiObj); break; case ORYX.CONFIG.EVENT_MOUSEOVER: this._handleMouseHover(event, uiObj); break; case ORYX.CONFIG.EVENT_MOUSEOUT: this._handleMouseOut(event, uiObj); break; } /* Force execution if necessary. Used while handle Layout-Callbacks. */ if(event.forceExecution) { this._executeEventImmediately({event: event, arg: uiObj}); } else { this._eventsQueue.push({event: event, arg: uiObj}); } if(!this._queueRunning) { this._executeEvents(); } // TODO: Make this return whether no listener returned false. // So that, when one considers bubbling undesireable, it won't happen. return false; }, catchKeyUpEvents: function(event) { if(!this._keyupEnabled) { return; } /* assure we have the current event. */ if (!event) event = window.event; // Checks if the event comes from some input field if ( ["INPUT", "TEXTAREA"].include(event.target.tagName.toUpperCase()) ){ return; } /* Create key up event type */ var keyUpEvent = this.createKeyCombEvent(event, ORYX.CONFIG.KEY_ACTION_UP); ORYX.Log.debug("Key Event to handle: %0", keyUpEvent); /* forward to dispatching. */ this.handleEvents({type: keyUpEvent, event:event}); }, /** * Catches all key down events and forward the appropriated event to * dispatching concerning to the pressed keys. * * @param {Event} * The key down event to handle */ catchKeyDownEvents: function(event) { if(!this._keydownEnabled) { return; } /* Assure we have the current event. */ if (!event) event = window.event; /* Fixed in FF3 */ // This is a mac-specific fix. The mozilla event object has no knowledge // of meta key modifier on osx, however, it is needed for certain // shortcuts. This fix adds the metaKey field to the event object, so // that all listeners that registered per Oryx plugin facade profit from // this. The original bug is filed in // https://bugzilla.mozilla.org/show_bug.cgi?id=418334 //if (this.__currentKey == ORYX.CONFIG.KEY_CODE_META) { // event.appleMetaKey = true; //} //this.__currentKey = pressedKey; // Checks if the event comes from some input field if ( ["INPUT", "TEXTAREA"].include(event.target.tagName.toUpperCase()) ){ return; } /* Create key up event type */ var keyDownEvent = this.createKeyCombEvent(event, ORYX.CONFIG.KEY_ACTION_DOWN); ORYX.Log.debug("Key Event to handle: %0", keyDownEvent); /* Forward to dispatching. */ this.handleEvents({type: keyDownEvent,event: event}); }, /** * Creates the event type name concerning to the pressed keys. * * @param {Event} keyDownEvent * The source keyDownEvent to build up the event name */ createKeyCombEvent: function(keyEvent, keyAction) { /* Get the currently pressed key code. */ var pressedKey = keyEvent.which || keyEvent.keyCode; //this.__currentKey = pressedKey; /* Event name */ var eventName = "key.event"; /* Key action */ if(keyAction) { eventName += "." + keyAction; } /* Ctrl or apple meta key is pressed */ if(keyEvent.ctrlKey || keyEvent.metaKey) { eventName += "." + ORYX.CONFIG.META_KEY_META_CTRL; } /* Alt key is pressed */ if(keyEvent.altKey) { eventName += "." + ORYX.CONFIG.META_KEY_ALT; } /* Alt key is pressed */ if(keyEvent.shiftKey) { eventName += "." + ORYX.CONFIG.META_KEY_SHIFT; } /* Return the composed event name */ return eventName + "." + pressedKey; }, _handleMouseDown: function(event, uiObj) { // find the shape that is responsible for this element's id. var element = event.currentTarget; var elementController = uiObj; // the element that currently holds focus should lose it window.focus(); // gather information on selection. var currentIsSelectable = (elementController !== null) && (elementController !== undefined) && (elementController.isSelectable); var currentIsMovable = (elementController !== null) && (elementController !== undefined) && (elementController.isMovable); var modifierKeyPressed = event.shiftKey || event.ctrlKey; var noObjectsSelected = this.selection.length === 0; var currentIsSelected = this.selection.member(elementController); // Rule #1: When there is nothing selected, select the clicked object. var newSelection; if(currentIsSelectable && noObjectsSelected) { this.setSelection([elementController], undefined, undefined, true); ORYX.Log.trace("Rule #1 applied for mouse down on %0", element.id); // Rule #3: When at least one element is selected, and there is no // control key pressed, and the clicked object is not selected, select // the clicked object. } else if(currentIsSelectable && !noObjectsSelected && !modifierKeyPressed && !currentIsSelected) { this.setSelection([elementController], undefined, undefined, true); //var objectType = elementController.readAttributes(); //alert(objectType[0] + ": " + objectType[1]); ORYX.Log.trace("Rule #3 applied for mouse down on %0", element.id); // Rule #4: When the control key is pressed, and the current object is // not selected, add it to the selection. } else if(currentIsSelectable && modifierKeyPressed && !currentIsSelected) { newSelection = this.selection.clone(); newSelection.push(elementController); this.setSelection(newSelection, undefined, undefined, true); ORYX.Log.trace("Rule #4 applied for mouse down on %0", element.id); // Rule #6 } else if(currentIsSelectable && currentIsSelected && modifierKeyPressed) { newSelection = this.selection.clone(); this.setSelection(newSelection.without(elementController), undefined, undefined, true); ORYX.Log.trace("Rule #6 applied for mouse down on %0", elementController.id); // Rule #5: When there is at least one object selected and no control // key pressed, we're dragging. /*} else if(currentIsSelectable && !noObjectsSelected && !modifierKeyPressed) { if(this.log.isTraceEnabled()) this.log.trace("Rule #5 applied for mouse down on "+element.id); */ // Rule #2: When clicked on something that is neither // selectable nor movable, clear the selection, and return. } else if (!currentIsSelectable && !currentIsMovable) { this.setSelection([], undefined, undefined, true); ORYX.Log.trace("Rule #2 applied for mouse down on %0", element.id); return; // Rule #7: When the current object is not selectable but movable, // it is probably a control. Leave the selection unchanged but set // the movedObject to the current one and enable Drag. Dockers will // be processed in the dragDocker plugin. } else if(!currentIsSelectable && currentIsMovable && !(elementController instanceof ORYX.Core.Controls.Docker)) { // TODO: If there is any moveable elements, do this in a plugin //ORYX.Core.UIEnableDrag(event, elementController); ORYX.Log.trace("Rule #7 applied for mouse down on %0", element.id); // Rule #8: When the element is selectable and is currently selected and no // modifier key is pressed } else if(currentIsSelectable && currentIsSelected && !modifierKeyPressed) { this._subSelection = this._subSelection != elementController ? elementController : undefined; this.setSelection(this.selection, this._subSelection, undefined, true); ORYX.Log.trace("Rule #8 applied for mouse down on %0", element.id); } // prevent event from bubbling, return. //Event.stop(event); return; }, _handleMouseMove: function(event, uiObj) { return; }, _handleMouseUp: function(event, uiObj) { // get canvas. var canvas = this.getCanvas(); // find the shape that is responsible for this elemement's id. var elementController = uiObj; //get event position var evPos = this.eventCoordinates(event); //Event.stop(event); }, _handleMouseHover: function(event, uiObj) { return; }, _handleMouseOut: function(event, uiObj) { return; }, /** * Calculates the event coordinates to SVG document coordinates. * @param {Event} event * @return {SVGPoint} The event coordinates in the SVG document */ eventCoordinates: function(event) { var canvas = this.getCanvas(); var svgPoint = canvas.node.ownerSVGElement.createSVGPoint(); svgPoint.x = event.clientX; svgPoint.y = event.clientY; var matrix = canvas.node.getScreenCTM(); return svgPoint.matrixTransform(matrix.inverse()); }, /** * Toggle read only/edit mode when the Blip changes from/to edit mode. */ changeMode: function changeMode(event) { this.layout.doLayout(); if (event.mode.isEditMode() && !event.mode.isPaintMode()) { this.disableReadOnlyMode(); } else { this.enableReadOnlyMode(); } } }; ORYX.Editor = Clazz.extend(ORYX.Editor); /** * Creates a new ORYX.Editor instance by fetching a model from given url and passing it to the constructur * @param {String} modelUrl The JSON URL of a model. * @param {Object} config Editor config passed to the constructur, merged with the response of the request to modelUrl */ ORYX.Editor.createByUrl = function(modelUrl, config){ if(!config) config = {}; new Ajax.Request(modelUrl, { method: 'GET', onSuccess: function(transport) { var editorConfig = Ext.decode(transport.responseText); editorConfig = Ext.applyIf(editorConfig, config); new ORYX.Editor(editorConfig); }.bind(this) }); }; // TODO Implement namespace awareness on attribute level. /** * graft() function * Originally by Sean M. Burke from interglacial.com, altered for usage with * SVG and namespace (xmlns) support. Be sure you understand xmlns before * using this funtion, as it creates all grafted elements in the xmlns * provided by you and all element's attribures in default xmlns. If you * need to graft elements in a certain xmlns and wish to assign attributes * in both that and another xmlns, you will need to do stepwise grafting, * adding non-default attributes yourself or you'll have to enhance this * function. Latter, I would appreciate: martin�apfelfabrik.de * @param {Object} namespace The namespace in which * elements should be grafted. * @param {Object} parent The element that should contain the grafted * structure after the function returned. * @param {Object} t the crafting structure. * @param {Object} doc the document in which grafting is performed. */ ORYX.Editor.graft = function(namespace, parent, t, doc) { doc = (doc || (parent && parent.ownerDocument) || document); var e; if(t === undefined) { throw "Can't graft an undefined value"; } else if(t.constructor == String) { e = doc.createTextNode( t ); } else { for(var i = 0; i < t.length; i++) { if( i === 0 && t[i].constructor == String ) { var snared; snared = t[i].match( /^([a-z][a-z0-9]*)\.([^\s\.]+)$/i ); if( snared ) { e = doc.createElementNS(namespace, snared[1] ); e.setAttributeNS(null, 'class', snared[2] ); continue; } snared = t[i].match( /^([a-z][a-z0-9]*)$/i ); if( snared ) { e = doc.createElementNS(namespace, snared[1] ); // but no class continue; } // Otherwise: e = doc.createElementNS(namespace, "span" ); e.setAttribute(null, "class", "namelessFromLOL" ); } if( t[i] === undefined ) { throw "Can't graft an undefined value in a list!"; } else if( t[i].constructor == String || t[i].constructor == Array ) { this.graft(namespace, e, t[i], doc ); } else if( t[i].constructor == Number ) { this.graft(namespace, e, t[i].toString(), doc ); } else if( t[i].constructor == Object ) { // hash's properties => element's attributes for(var k in t[i]) { e.setAttributeNS(null, k, t[i][k] ); } } else { } } } if(parent) { parent.appendChild( e ); } else { } return e; // return the topmost created node }; ORYX.Editor.provideId = function() { var i; var res = [], hex = '0123456789ABCDEF'; for (i = 0; i < 36; i++) res[i] = Math.floor(Math.random()*0x10); res[14] = 4; res[19] = (res[19] & 0x3) | 0x8; for (i = 0; i < 36; i++) res[i] = hex[res[i]]; res[8] = res[13] = res[18] = res[23] = '-'; return "oryx_" + res.join(''); }; /** * When working with Ext, conditionally the window needs to be resized. To do * so, use this class method. Resize is deferred until 100ms, and all subsequent * resizeBugFix calls are ignored until the initially requested resize is * performed. */ ORYX.Editor.resizeFix = function() { if (!ORYX.Editor._resizeFixTimeout) { ORYX.Editor._resizeFixTimeout = window.setTimeout(function() { window.resizeBy(1,1); window.resizeBy(-1,-1); ORYX.Editor._resizefixTimeout = null; }, 100); } }; ORYX.Editor.Cookie = { callbacks:[], onChange: function( callback, interval ) { this.callbacks.push(callback); this.start( interval ); }, start: function( interval ){ if( this.pe ){ return; } var currentString = document.cookie; this.pe = new PeriodicalExecuter(function(){ if( currentString != document.cookie ){ currentString = document.cookie; this.callbacks.each(function(callback){ callback(this.getParams()); }.bind(this)); } }.bind(this), ( interval || 10000 ) / 1000); }, stop: function(){ if( this.pe ){ this.pe.stop(); this.pe = null; } }, getParams: function(){ var res = {}; var p = document.cookie; p.split("; ").each(function(param){ res[param.split("=")[0]] = param.split("=")[1];}); return res; }, toString: function(){ return document.cookie; } }; /** * Workaround for SAFARI/Webkit, because * when trying to check SVGSVGElement of instanceof there is * raising an error * */ ORYX.Editor.SVGClassElementsAreAvailable = true; ORYX.Editor.setMissingClasses = function() { try { SVGElement; } catch(e) { ORYX.Editor.SVGClassElementsAreAvailable = false; SVGSVGElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg').toString(); SVGGElement = document.createElementNS('http://www.w3.org/2000/svg', 'g').toString(); SVGPathElement = document.createElementNS('http://www.w3.org/2000/svg', 'path').toString(); SVGTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text').toString(); //SVGMarkerElement = document.createElementNS('http://www.w3.org/2000/svg', 'marker').toString(); SVGRectElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect').toString(); SVGImageElement = document.createElementNS('http://www.w3.org/2000/svg', 'image').toString(); SVGCircleElement = document.createElementNS('http://www.w3.org/2000/svg', 'circle').toString(); SVGEllipseElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse').toString(); SVGLineElement = document.createElementNS('http://www.w3.org/2000/svg', 'line').toString(); SVGPolylineElement = document.createElementNS('http://www.w3.org/2000/svg', 'polyline').toString(); SVGPolygonElement = document.createElementNS('http://www.w3.org/2000/svg', 'polygon').toString(); } }; ORYX.Editor.checkClassType = function( classInst, classType ) { if( ORYX.Editor.SVGClassElementsAreAvailable ){ return classInst instanceof classType; } else { return classInst == classType; } }; ORYX.Editor.makeExtModalWindowKeysave = function(facade) { Ext.override(Ext.Window,{ beforeShow : function(){ delete this.el.lastXY; delete this.el.lastLT; if(this.x === undefined || this.y === undefined){ var xy = this.el.getAlignToXY(this.container, 'c-c'); var pos = this.el.translatePoints(xy[0], xy[1]); this.x = this.x === undefined? pos.left : this.x; this.y = this.y === undefined? pos.top : this.y; } this.el.setLeftTop(this.x, this.y); if(this.expandOnShow){ this.expand(false); } if(this.modal){ facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN); Ext.getBody().addClass("x-body-masked"); this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true)); this.mask.show(); } }, afterHide : function(){ this.proxy.hide(); if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){ Ext.EventManager.removeResizeListener(this.onWindowResize, this); } if(this.modal){ this.mask.hide(); facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN); Ext.getBody().removeClass("x-body-masked"); } if(this.keyMap){ this.keyMap.disable(); } this.fireEvent("hide", this); }, beforeDestroy : function(){ if(this.modal) facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN); Ext.destroy( this.resizer, this.dd, this.proxy, this.mask ); Ext.Window.superclass.beforeDestroy.call(this); } }); }; ORYX.Editor.ModeManager = Clazz.extend({ construct: function construct(facade) { this.paintMode = false; this.editMode = false; this.facade = facade; facade.registerOnEvent(ORYX.CONFIG.EVENT_BLIP_TOGGLED, this._onBlipToggled.bind(this)); facade.registerOnEvent(ORYX.CONFIG.EVENT_PAINT_CANVAS_TOGGLED, this._onPaintModeToggled.bind(this)); }, isPaintMode: function isPaintMode() { return this.paintMode; }, isEditMode: function isEditMode() { return this.editMode; }, _onPaintModeToggled: function _onPaintModeToggled(event) { this.paintMode = event.paintActive; this._raiseEvent(); }, _onBlipToggled: function _onBlipToggled(event) { this.editMode = event.editMode; this._raiseEvent(); }, _raiseEvent: function _raiseEvent() { this.facade.raiseEvent({ type: ORYX.CONFIG.EVENT_MODE_CHANGED, mode: this }); } });
08to09-processwave
oryx/editor/client/scripts/Core/main.js
JavaScript
mit
84,242
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ if(!ORYX){ var ORYX = {} } if(!ORYX.Plugins){ ORYX.Plugins = {} } /** This abstract plugin implements the core behaviour of layout @class ORYX.Plugins.AbstractLayouter @constructor Creates a new instance @author Willi Tscheschner */ ORYX.Plugins.AbstractLayouter = ORYX.Plugins.AbstractPlugin.extend({ /** * 'layouted' defined all types of shapes which will be layouted. * It can be one value or an array of values. The value * can be a Stencil ID (as String) or an class type of either * a ORYX.Core.Node or ORYX.Core.Edge * @type Array|String|Object * @memberOf ORYX.Plugins.AbstractLayouter.prototype */ layouted : [], /** * Constructor * @param {Object} facade * @memberOf ORYX.Plugins.AbstractLayouter.prototype */ construct: function( facade ){ arguments.callee.$.construct.apply(this, arguments); this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LAYOUT, this._initLayout.bind(this)); }, /** * Proofs if this shape should be layouted or not * @param {Object} shape * @memberOf ORYX.Plugins.AbstractLayouter.prototype */ isIncludedInLayout: function(shape){ if (!(this.layouted instanceof Array)){ this.layouted = [this.layouted].compact(); } // If there are no elements if (this.layouted.length <= 0) { // Return TRUE return true; } // Return TRUE if there is any correlation between // the 'layouted' attribute and the shape themselve. return this.layouted.any(function(s){ if (typeof s == "string") { return shape.getStencil().id().include(s); } else { return shape instanceof s; } }) }, /** * Callback to start the layouting * @param {Object} event Layout event * @param {Object} shapes Given shapes * @memberOf ORYX.Plugins.AbstractLayouter.prototype */ _initLayout: function(event){ // Get the shapes var shapes = [event.shapes].flatten().compact(); // Find all shapes which should be layouted var toLayout = shapes.findAll(function(shape){ return this.isIncludedInLayout(shape) }.bind(this)) // If there are shapes left if (toLayout.length > 0){ // Do layout this.layout(toLayout); } }, /** * Implementation of layouting a set on shapes * @param {Object} shapes Given shapes * @memberOf ORYX.Plugins.AbstractLayouter.prototype */ layout: function(shapes){ throw new Error("Layouter has to implement the layout function.") } });
08to09-processwave
oryx/editor/client/scripts/Core/abstractLayouter.js
JavaScript
mit
3,997
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} /** * Top Level uiobject. * @class ORYX.Core.AbstractShape * @extends ORYX.Core.UIObject */ ORYX.Core.AbstractShape = ORYX.Core.UIObject.extend( /** @lends ORYX.Core.AbstractShape.prototype */ { /** * Constructor */ construct: function(options, stencil) { arguments.callee.$.construct.apply(this, arguments); if (!options || typeof options["resourceId"] === "undefined") { this.resourceId = ORYX.Editor.provideId(); //Id of resource in DOM } else { this.resourceId = options["resourceId"]; } // stencil reference this._stencil = stencil; // if the stencil defines a super stencil that should be used for its instances, set it. if (this._stencil._jsonStencil.superId){ stencilId = this._stencil.id() superStencilId = stencilId.substring(0, stencilId.indexOf("#") + 1) + stencil._jsonStencil.superId; stencilSet = this._stencil.stencilSet(); this._stencil = stencilSet.stencil(superStencilId); } //Hash map for all properties. Only stores the values of the properties. this.properties = new Hash(); this.propertiesChanged = new Hash(); // List of properties which are not included in the stencilset, // but which gets (de)serialized this.hiddenProperties = new Hash(); this.bounds.registerCallback(this.onBoundsChanged.bind(this)); //Initialization of property map and initial value. this._stencil.properties().each((function(property) { var key = property.prefix() + "-" + property.id(); this.properties[key] = property.value(); this.propertiesChanged[key] = true; }).bind(this)); // if super stencil was defined, also regard stencil's properties: if (stencil._jsonStencil.superId) { stencil.properties().each((function(property) { var key = property.prefix() + "-" + property.id(); var value = property.value(); var oldValue = this.properties[key]; this.properties[key] = value; this.propertiesChanged[key] = true; // Raise an event, to show that the property has changed // required for plugins like processLink.js //window.setTimeout( function(){ this._delegateEvent({ type : ORYX.CONFIG.EVENT_PROPERTY_CHANGED, name : key, value : value, oldValue: oldValue }); //}.bind(this), 10) }).bind(this)); } }, onBoundsChanged: function onBoundsChanged(bounds) { this._delegateEvent( { type : ORYX.CONFIG.EVENT_SHAPEBOUNDS_CHANGED, shape : this } ); }, layout: function() { }, /** * Returns the stencil object specifiing the type of the shape. */ getStencil: function() { return this._stencil; }, /** * * @param {Object} resourceId */ getChildShapeByResourceId: function(resourceId) { resourceId = ERDF.__stripHashes(resourceId); return this.getChildShapes(true).find(function(shape) { return shape.resourceId == resourceId }); }, /** * * @param {Object} deep * @param {Object} iterator */ getChildShapes: function(deep, iterator) { var result = []; this.children.each(function(uiObject) { if(uiObject instanceof ORYX.Core.Shape && uiObject.isVisible ) { if(iterator) { iterator(uiObject); } result.push(uiObject); if(deep) { result = result.concat(uiObject.getChildShapes(deep, iterator)); } } }); return result; }, /** * @param {Object} shape * @return {boolean} true if any of shape's childs is given shape */ hasChildShape: function(shape){ return this.getChildShapes().any(function(child){ return (child === shape) || child.hasChildShape(shape); }); }, /** * * @param {Object} deep * @param {Object} iterator */ getChildNodes: function(deep, iterator) { var result = []; this.children.each(function(uiObject) { if(uiObject instanceof ORYX.Core.Node && uiObject.isVisible) { if(iterator) { iterator(uiObject); } result.push(uiObject); } if(uiObject instanceof ORYX.Core.Shape) { if(deep) { result = result.concat(uiObject.getChildNodes(deep, iterator)); } } }); return result; }, /** * * @param {Object} deep * @param {Object} iterator */ getChildEdges: function(deep, iterator) { var result = []; this.children.each(function(uiObject) { if(uiObject instanceof ORYX.Core.Edge && uiObject.isVisible) { if(iterator) { iterator(uiObject); } result.push(uiObject); } if(uiObject instanceof ORYX.Core.Shape) { if(deep) { result = result.concat(uiObject.getChildEdges(deep, iterator)); } } }); return result; }, /** * Returns a sorted array of ORYX.Core.Node objects. * Ordered in z Order, the last object has the highest z Order. */ //TODO deep iterator getAbstractShapesAtPosition: function() { var x, y; switch (arguments.length) { case 1: x = arguments[0].x; y = arguments[0].y; break; case 2: //two or more arguments x = arguments[0]; y = arguments[1]; break; default: throw "getAbstractShapesAtPosition needs 1 or 2 arguments!" } if(this.isPointIncluded(x, y)) { var result = []; result.push(this); //check, if one child is at that position var childNodes = this.getChildNodes(); var childEdges = this.getChildEdges(); [childNodes, childEdges].each(function(ne){ var nodesAtPosition = new Hash(); ne.each(function(node) { if(!node.isVisible){ return } var candidates = node.getAbstractShapesAtPosition( x , y ); if(candidates.length > 0) { var nodesInZOrder = $A(node.node.parentNode.childNodes); var zOrderIndex = nodesInZOrder.indexOf(node.node); nodesAtPosition[zOrderIndex] = candidates; } }); nodesAtPosition.keys().sort().each(function(key) { result = result.concat(nodesAtPosition[key]); }); }); return result; } else { return []; } }, /** * * @param key {String} Must be 'prefix-id' of property * @param value {Object} Can be of type String or Number according to property type. */ setProperty: function(key, value, force) { var oldValue = this.properties[key]; if(oldValue !== value || force === true) { this.properties[key] = value; this.propertiesChanged[key] = true; this._changed(); // Raise an event, to show that the property has changed //window.setTimeout( function(){ if (!this._isInSetProperty) { this._isInSetProperty = true; this._delegateEvent({ type : ORYX.CONFIG.EVENT_PROPERTY_CHANGED, elements : [this], name : key, value : value, oldValue: oldValue }); delete this._isInSetProperty; } //}.bind(this), 10) } }, /** * * @param {String} Must be 'prefix-id' of property * @param {Object} Can be of type String or Number according to property type. */ setHiddenProperty: function(key, value) { // IF undefined, Delete if (value === undefined) { delete this.hiddenProperties[key]; return; } var oldValue = this.hiddenProperties[key]; if(oldValue !== value) { this.hiddenProperties[key] = value; } }, /** * Calculate if the point is inside the Shape * @param {Point} */ isPointIncluded: function(pointX, pointY, absoluteBounds) { var absBounds = absoluteBounds ? absoluteBounds : this.absoluteBounds(); return absBounds.isIncluded(pointX, pointY); }, /** * Get the serialized object * return Array with hash-entrees (prefix, name, value) * Following values will given: * Type * Properties */ serialize: function() { var serializedObject = []; // Add the type serializedObject.push({name: 'type', prefix:'oryx', value: this.getStencil().id(), type: 'literal'}); // Add hidden properties this.hiddenProperties.each(function(prop){ serializedObject.push({name: prop.key.replace("oryx-", ""), prefix: "oryx", value: prop.value, type: 'literal'}); }.bind(this)); // Add all properties this.getStencil().properties().each((function(property){ var prefix = property.prefix(); // Get prefix var name = property.id(); // Get name //if(typeof this.properties[prefix+'-'+name] == 'boolean' || this.properties[prefix+'-'+name] != "") serializedObject.push({name: name, prefix: prefix, value: this.properties[prefix+'-'+name], type: 'literal'}); }).bind(this)); return serializedObject; }, deserialize: function(serialize){ // Search in Serialize var initializedDocker = 0; // Sort properties so that the hidden properties are first in the list serialize = serialize.sort(function(a,b){ return Number(this.properties.keys().member(a.prefix+"-"+a.name)) > Number(this.properties.keys().member(b.prefix+"-"+b.name)) ? -1 : 0 }.bind(this)); serialize.each((function(obj){ var name = obj.name; var prefix = obj.prefix; var value = obj.value; // Complex properties can be real json objects, encode them to a string if(Ext.type(value) === "object") value = Ext.encode(value); switch(prefix + "-" + name){ case 'raziel-parent': // Set parent if(!this.parent) {break}; // Set outgoing Shape var parent = this.getCanvas().getChildShapeByResourceId(value); if(parent) { parent.add(this); } break; default: // Set property if(this.properties.keys().member(prefix+"-"+name)) { this.setProperty(prefix+"-"+name, value); } else if(!(name === "bounds"||name === "parent"||name === "target"||name === "dockers"||name === "docker"||name === "outgoing"||name === "incoming")) { this.setHiddenProperty(prefix+"-"+name, value); } } }).bind(this)); }, toString: function() { return "ORYX.Core.AbstractShape " + this.id }, /** * Converts the shape to a JSON representation. * @return {Object} A JSON object with included ORYX.Core.AbstractShape.JSONHelper and getShape() method. */ toJSON: function(){ var json = { resourceId: this.resourceId, properties: Ext.apply({}, this.properties, this.hiddenProperties).inject({}, function(props, prop){ var key = prop[0]; var value = prop[1]; //If complex property, value should be a json object if(this.getStencil().property(key) && this.getStencil().property(key).type() === ORYX.CONFIG.TYPE_COMPLEX && Ext.type(value) === "string"){ try {value = Ext.decode(value);} catch(error){} } //Takes "my_property" instead of "oryx-my_property" as key key = key.replace(/^[\w_]+-/, ""); props[key] = value; return props; }.bind(this)), stencil: { id: this.getStencil().idWithoutNs() }, childShapes: this.getChildShapes().map(function(shape){ return shape.toJSON() }) }; if(this.getOutgoingShapes){ json.outgoing = this.getOutgoingShapes().map(function(shape){ return { resourceId: shape.resourceId }; }); } if(this.bounds){ json.bounds = { lowerRight: this.bounds.lowerRight(), upperLeft: this.bounds.upperLeft() }; } if(this.dockers){ json.dockers = this.dockers.map(function(docker){ var d = docker.getDockedShape() && docker.referencePoint ? docker.referencePoint : docker.bounds.center(); d.getDocker = function(){return docker;}; d.id = docker.id; return d; }) } Ext.apply(json, ORYX.Core.AbstractShape.JSONHelper); // do not pollute the json attributes (for serialization), so put the corresponding // shape is encapsulated in a method json.getShape = function(){ return this; }.bind(this); return json; } }); /** * @namespace Collection of methods which can be used on a shape json object (ORYX.Core.AbstractShape#toJSON()). * @example * Ext.apply(shapeAsJson, ORYX.Core.AbstractShape.JSONHelper); */ ORYX.Core.AbstractShape.JSONHelper = { /** * Iterates over each child shape. * @param {Object} iterator Iterator function getting a child shape and his parent as arguments. * @param {boolean} [deep=false] Iterate recursively (childShapes of childShapes) * @param {boolean} [modify=false] If true, the result of the iterator function is taken as new shape, return false to delete it. This enables modifying the object while iterating through the child shapes. * @example * // Increases the lowerRight x value of each direct child shape by one. * myShapeAsJson.eachChild(function(shape, parentShape){ * shape.bounds.lowerRight.x = shape.bounds.lowerRight.x + 1; * return shape; * }, false, true); */ eachChild: function(iterator, deep, modify){ if(!this.childShapes) return; var newChildShapes = []; //needed if modify = true this.childShapes.each(function(shape){ var res = iterator(shape, this); if(res) newChildShapes.push(res); //if false is returned, and modify = true, current shape is deleted. if(deep) shape.eachChild(iterator, deep, modify); }.bind(this)); if(modify) this.childShapes = newChildShapes; }, getChildShapes: function(deep){ var allShapes = this.childShapes; if(deep){ this.eachChild(function(shape){ allShapes = allShapes.concat(shape.getChildShapes(deep)); }, true); } return allShapes; }, /** * @return {String} Serialized JSON object */ serialize: function(){ return Ext.encode(this); } }
08to09-processwave
oryx/editor/client/scripts/Core/abstractshape.js
JavaScript
mit
16,354
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if (!ORYX) { var ORYX = {}; } if (!ORYX.Core) { ORYX.Core = {}; } // command repository ORYX.Core.Commands = {}; /** * Glossary: * commandObject = Metadata + commandData */ ORYX.Core.AbstractCommand = Clazz.extend({ /** * Call this from the child class with: * arguments.callee.$.construct.call(this, facade); * The doNotAddMetadataToShapes is optional. In most cases it should be set to false. */ construct: function construct(facade, doNotAddMetadata) { this.metadata = {}; this.metadata.id = ORYX.Editor.provideId(); this.metadata.name = this.getCommandName(); this.metadata.creatorId = facade.getUserId(); this.metadata.createdAt = new Date().getTime(); this.metadata.local = true; this.metadata.putOnStack = true; this.facade = facade; /*this.execute2 = this.execute; this.execute = function() { this.execute2(); var shapes = this.getAffectedShapes(); for (var i = 0; i < shapes.length; i++) { shapes[i].metadata = { 'changedAt': this.getCreatedAt(), 'changedBy': this.getCreatorId() }; } }.bind(this);*/ if (!doNotAddMetadata) { this.execute = function wrappedExecute(executeFunction) { executeFunction(); this.getAffectedShapes().each(function injectMetadataIntoShape(shape) { if (typeof shape.metadata === "undefined") { return; }; shape.metadata.changedAt.push(this.getCreatedAt()); shape.metadata.changedBy.push(this.getCreatorId()); shape.metadata.commands.push(this.getDisplayName()); shape.metadata.isLocal = this.isLocal(); this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED, 'shape': shape }); }.bind(this)); }.bind(this, this.execute.bind(this)); this.rollback = function wrappedExecute(rollbackFunction) { rollbackFunction(); this.getAffectedShapes().each(function injectMetadataIntoShape(shape) { if (typeof shape.metadata === "undefined") { return; }; shape.metadata.changedAt.pop(); shape.metadata.changedBy.pop(); shape.metadata.commands.pop(); shape.metadata.isLocal = this.isLocal(); this.facade.raiseEvent({ 'type': ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED, 'shape': shape }); }.bind(this)); }.bind(this, this.rollback.bind(this)); } }, getCommandId: function getCommandId() { return this.metadata.id; }, getCreatorId: function getCreatorId() { return this.metadata.creatorId; }, getCreatedAt: function getCreatedAt() { return this.metadata.createdAt; }, /** * Create a command object from the commandData object. * commandData is an object provided by the getCommandData() method. * * @static */ createFromCommandData: function createFromCommandData(facade, commandData) { throw "AbstractCommand.createFromCommandData() has to be implemented"; }, /** * @return Array(Oryx.Core.Shape) All shapes modified by this command */ getAffectedShapes: function getAffectedShapes() { throw "AbstractCommand.getAffectedShapes() has to be implemented"; }, /** * Should return a string/object/... that allows the command to be reconstructed * Basically: * createFromCommandData(this.getCommandData) === this * @return Object has to be serializable */ getCommandData: function getCommandData() { throw "AbstractCommand.getCommandData() has to be implemented"; }, /** * Name of this command, usually in the from of <plugin name>.<command description> * e.g.: * DragDropResize.DropCommand * ShapeMenu.CreateCommand * @return string */ getCommandName: function getCommandName() { throw "AbstractCommand.getCommandName() has to be implemented"; }, /** * Should be overwritten by subclasses and return the command name in a human readable format. * e.g.: * Shape deleted * @return string */ getDisplayName: function getDisplayName() { return this.getCommandName(); }, execute: function execute() { throw "AbstractCommand.execute() has to be implemented"; }, rollback: function rollback() { throw "AbstractCommand.rollback() has to be implemented!"; }, /** * @return Boolean */ isLocal: function isLocal() { return this.metadata.local; }, jsonSerialize: function jsonSerialize() { var commandData = this.getCommandData(); var commandObject = { 'id': this.getCommandId(), 'name': this.getCommandName(), 'creatorId': this.getCreatorId(), 'createdAt': this.getCreatedAt(), 'data': commandData, 'putOnStack': this.metadata.putOnStack }; return Object.toJSON(commandObject); }, /** * @static */ jsonDeserialize: function jsonDeserialize(facade, commandString) { var commandObject = commandString.evalJSON(); var commandInstance = ORYX.Core.Commands[commandObject.name].prototype.createFromCommandData(facade, commandObject.data); if (typeof commandInstance !== 'undefined') { commandInstance.setMetadata({ 'id': commandObject.id, 'name': commandObject.name, 'creatorId': commandObject.creatorId, 'createdAt': commandObject.createdAt, 'putOnStack': commandObject.putOnStack, 'local': false }); } return commandInstance; }, setMetadata: function setMetadata(metadata) { this.metadata = Object.clone(metadata); } });
08to09-processwave
oryx/editor/client/scripts/Core/abstractcommand.js
JavaScript
mit
7,925
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} /** * @classDescription With Bounds you can set and get position and size of UIObjects. */ ORYX.Core.Command = Clazz.extend({ /** * Constructor */ construct: function() { }, execute: function(){ throw "Command.execute() has to be implemented!" }, rollback: function(){ throw "Command.rollback() has to be implemented!" } });
08to09-processwave
oryx/editor/client/scripts/Core/command.js
JavaScript
mit
1,934
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespace */ if (!ORYX) { var ORYX = {}; } if (!ORYX.Core) { ORYX.Core = {}; } if (!ORYX.Core.StencilSet) { ORYX.Core.StencilSet = {}; } /** * This class represents a stencil set. It offers methods for accessing * the attributes of the stencil set description JSON file and the stencil set's * stencils. */ ORYX.Core.StencilSet.StencilSet = Clazz.extend({ /** * Constructor * @param source {URL} A reference to the stencil set specification. * */ construct: function(source){ arguments.callee.$.construct.apply(this, arguments); if (!source) { throw "ORYX.Core.StencilSet.StencilSet(construct): Parameter 'source' is not defined."; } if (source.endsWith("/")) { source = source.substr(0, source.length - 1); } this._extensions = new Hash(); this._source = source; this._baseUrl = source.substring(0, source.lastIndexOf("/") + 1); this._jsonObject = {}; this._stencils = new Hash(); this._availableStencils = new Hash(); if(ORYX.CONFIG.BACKEND_SWITCH) { //get the url of the stencil set json file new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: this._getJSONURL.bind(this), onFailure: this._cancelInit.bind(this) }); } else { new Ajax.Request(source, { asynchronous: false, method: 'get', onSuccess: this._init.bind(this), onFailure: this._cancelInit.bind(this) }); } if (this.errornous) throw "Loading stencil set " + source + " failed."; }, /** * Finds a root stencil in this stencil set. There may be many of these. If * there are, the first one found will be used. In Firefox, this is the * topmost definition in the stencil set description file. */ findRootStencilName: function(){ // find any stencil that may be root. var rootStencil = this._stencils.values().find(function(stencil){ return stencil._jsonStencil.mayBeRoot }); // if there is none, just guess the first. if (!rootStencil) { ORYX.Log.warn("Did not find any stencil that may be root. Taking a guess."); rootStencil = this._stencils.values()[0]; } // return its id. return rootStencil.id(); }, /** * @param {ORYX.Core.StencilSet.StencilSet} stencilSet * @return {Boolean} True, if stencil set has the same namespace. */ equals: function(stencilSet){ return (this.namespace() === stencilSet.namespace()); }, /** * * @param {Oryx.Core.StencilSet.Stencil} rootStencil If rootStencil is defined, it only returns stencils * that could be (in)direct child of that stencil. */ stencils: function(rootStencil, rules, sortByGroup){ if(rootStencil && rules) { var stencils = this._availableStencils.values(); var containers = [rootStencil]; var checkedContainers = []; var result = []; while (containers.size() > 0) { var container = containers.pop(); checkedContainers.push(container); var children = stencils.findAll(function(stencil){ var args = { containingStencil: container, containedStencil: stencil }; return rules.canContain(args); }); for(var i = 0; i < children.size(); i++) { if (!checkedContainers.member(children[i])) { containers.push(children[i]); } } result = result.concat(children).uniq(); } // Sort the result to the origin order result = result.sortBy(function(stencil) { return stencils.indexOf(stencil); }); if(sortByGroup) { result = result.sortBy(function(stencil) { return stencil.groups().first(); }); } var edges = stencils.findAll(function(stencil) { return stencil.type() == "edge"; }); result = result.concat(edges); return result; } else { if(sortByGroup) { return this._availableStencils.values().sortBy(function(stencil) { return stencil.groups().first(); }); } else { return this._availableStencils.values(); } } }, nodes: function(){ return this._availableStencils.values().findAll(function(stencil){ return (stencil.type() === 'node') }); }, edges: function(){ return this._availableStencils.values().findAll(function(stencil){ return (stencil.type() === 'edge') }); }, stencil: function(id){ return this._stencils[id]; }, title: function(){ return ORYX.Core.StencilSet.getTranslation(this._jsonObject, "title"); }, description: function(){ return ORYX.Core.StencilSet.getTranslation(this._jsonObject, "description"); }, namespace: function(){ return this._jsonObject ? this._jsonObject.namespace : null; }, jsonRules: function(){ return this._jsonObject ? this._jsonObject.rules : null; }, source: function(){ return this._source; }, extensions: function() { return this._extensions; }, addExtension: function(url) { new Ajax.Request(url, { method: 'GET', asynchronous: false, onSuccess: (function(transport) { this.addExtensionDirectly(transport.responseText); }).bind(this), onFailure: (function(transport) { ORYX.Log.debug("Loading stencil set extension file failed. The request returned an error." + transport); }).bind(this), onException: (function(transport) { ORYX.Log.debug("Loading stencil set extension file failed. The request returned an error." + transport); }).bind(this) }); }, addExtensionDirectly: function(str){ try { eval("var jsonExtension = " + str); if(!(jsonExtension["extends"].endsWith("#"))) jsonExtension["extends"] += "#"; if(jsonExtension["extends"] == this.namespace()) { this._extensions[jsonExtension.namespace] = jsonExtension; var defaultPosition = this._stencils.keys().size(); //load new stencils if(jsonExtension.stencils) { $A(jsonExtension.stencils).each(function(stencil) { defaultPosition++; var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this, undefined, defaultPosition); this._stencils[oStencil.id()] = oStencil; this._availableStencils[oStencil.id()] = oStencil; }.bind(this)); } //load additional properties if (jsonExtension.properties) { var stencils = this._stencils.values(); stencils.each(function(stencil){ var roles = stencil.roles(); jsonExtension.properties.each(function(prop){ prop.roles.any(function(role){ role = jsonExtension["extends"] + role; if (roles.member(role)) { prop.properties.each(function(property){ stencil.addProperty(property, jsonExtension.namespace); }); return true; } else return false; }) }) }.bind(this)); } //remove stencil properties if(jsonExtension.removeproperties) { jsonExtension.removeproperties.each(function(remprop) { var stencil = this.stencil(jsonExtension["extends"] + remprop.stencil); if(stencil) { remprop.properties.each(function(propId) { stencil.removeProperty(propId); }); } }.bind(this)); } //remove stencils if(jsonExtension.removestencils) { $A(jsonExtension.removestencils).each(function(remstencil) { delete this._availableStencils[jsonExtension["extends"] + remstencil]; }.bind(this)); } } } catch (e) { ORYX.Log.debug("StencilSet.addExtension: Something went wrong when initialising the stencil set extension. " + e); } }, removeExtension: function(namespace) { var jsonExtension = this._extensions[namespace]; if(jsonExtension) { //unload extension's stencils if(jsonExtension.stencils) { $A(jsonExtension.stencils).each(function(stencil) { var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this); delete this._stencils[oStencil.id()]; // maybe not ?? delete this._availableStencils[oStencil.id()]; }.bind(this)); } //unload extension's properties if (jsonExtension.properties) { var stencils = this._stencils.values(); stencils.each(function(stencil){ var roles = stencil.roles(); jsonExtension.properties.each(function(prop){ prop.roles.any(function(role){ role = jsonExtension["extends"] + role; if (roles.member(role)) { prop.properties.each(function(property){ stencil.removeProperty(property.id); }); return true; } else return false; }) }) }.bind(this)); } //restore removed stencil properties if(jsonExtension.removeproperties) { jsonExtension.removeproperties.each(function(remprop) { var stencil = this.stencil(jsonExtension["extends"] + remprop.stencil); if(stencil) { var stencilJson = $A(this._jsonObject.stencils).find(function(s) { return s.id == stencil.id() }); remprop.properties.each(function(propId) { var propertyJson = $A(stencilJson.properties).find(function(p) { return p.id == propId }); stencil.addProperty(propertyJson, this.namespace()); }.bind(this)); } }.bind(this)); } //restore removed stencils if(jsonExtension.removestencils) { $A(jsonExtension.removestencils).each(function(remstencil) { var sId = jsonExtension["extends"] + remstencil; this._availableStencils[sId] = this._stencils[sId]; }.bind(this)); } } delete this._extensions[namespace]; }, __handleStencilset: function(response){ try { // using eval instead of prototype's parsing, // since there are functions in this JSON. eval("this._jsonObject =" + response.responseText); } catch (e) { throw "Stenciset corrupt: " + e; } // assert it was parsed. if (!this._jsonObject) { throw "Error evaluating stencilset. It may be corrupt."; } with (this._jsonObject) { // assert there is a namespace. if (!namespace || namespace === "") throw "Namespace definition missing in stencilset."; if (!(stencils instanceof Array)) throw "Stencilset corrupt."; // assert namespace ends with '#'. if (!namespace.endsWith("#")) namespace = namespace + "#"; // assert title and description are strings. if (!title) title = ""; if (!description) description = ""; } }, _getJSONURL: function(response) { this._baseUrl = response.responseText.substring(0, response.responseText.lastIndexOf("/") + 1); this._source = response.responseText; new Ajax.Request(response.responseText, { asynchronous: false, method: 'get', onSuccess: this._init.bind(this), onFailure: this._cancelInit.bind(this) }); }, /** * This method is called when the HTTP request to get the requested stencil * set succeeds. The response is supposed to be a JSON representation * according to the stencil set specification. * @param {Object} response The JSON representation according to the * stencil set specification. */ _init: function(response){ // init and check consistency. this.__handleStencilset(response); var pps = new Hash(); // init property packages if(this._jsonObject.propertyPackages) { $A(this._jsonObject.propertyPackages).each((function(pp) { pps[pp.name] = pp.properties; }).bind(this)); } var defaultPosition = 0; // init each stencil $A(this._jsonObject.stencils).each((function(stencil){ defaultPosition++; // instantiate normally. var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this, pps, defaultPosition); this._stencils[oStencil.id()] = oStencil; this._availableStencils[oStencil.id()] = oStencil; }).bind(this)); }, _cancelInit: function(response){ this.errornous = true; }, toString: function(){ return "StencilSet " + this.title() + " (" + this.namespace() + ")"; } });
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/stencilset.js
JavaScript
mit
14,841
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};} /** * Class Rules uses Prototpye 1.5.0 uses Inheritance * * This class implements the API to check the stencil sets' rules. */ ORYX.Core.StencilSet.Rules = { /** * Constructor */ construct: function() { arguments.callee.$.construct.apply(this, arguments); this._stencilSets = []; this._stencils = []; this._cachedConnectSET = new Hash(); this._cachedConnectSE = new Hash(); this._cachedConnectTE = new Hash(); this._cachedCardSE = new Hash(); this._cachedCardTE = new Hash(); this._cachedContainPC = new Hash(); this._cachedMorphRS = new Hash(); this._connectionRules = new Hash(); this._cardinalityRules = new Hash(); this._containmentRules = new Hash(); this._morphingRules = new Hash(); this._layoutRules = new Hash(); }, /** * Call this method to initialize the rules for a stencil set and all of its * active extensions. * * @param {Object} * stencilSet */ initializeRules: function(stencilSet) { var existingSS = this._stencilSets.find(function(ss) { return (ss.namespace() == stencilSet.namespace()); }); if (existingSS) { // reinitialize all rules var stencilsets = this._stencilSets.clone(); stencilsets = stencilsets.without(existingSS); stencilsets.push(stencilSet); this._stencilSets = []; this._stencils = []; this._cachedConnectSET = new Hash(); this._cachedConnectSE = new Hash(); this._cachedConnectTE = new Hash(); this._cachedCardSE = new Hash(); this._cachedCardTE = new Hash(); this._cachedContainPC = new Hash(); this._cachedMorphRS = new Hash(); this._connectionRules = new Hash(); this._cardinalityRules = new Hash(); this._containmentRules = new Hash(); this._morphingRules = new Hash(); this._layoutRules = new Hash(); stencilsets.each(function(ss){ this.initializeRules(ss); }.bind(this)); return; } else { this._stencilSets.push(stencilSet); var jsonRules = new Hash(stencilSet.jsonRules()); var namespace = stencilSet.namespace(); var stencils = stencilSet.stencils(); stencilSet.extensions().values().each(function(extension) { if(extension.rules) { if(extension.rules.connectionRules) jsonRules.connectionRules = jsonRules.connectionRules.concat(extension.rules.connectionRules); if(extension.rules.cardinalityRules) jsonRules.cardinalityRules = jsonRules.cardinalityRules.concat(extension.rules.cardinalityRules); if(extension.rules.containmentRules) jsonRules.containmentRules = jsonRules.containmentRules.concat(extension.rules.containmentRules); if(extension.rules.morphingRules) jsonRules.morphingRules = jsonRules.morphingRules.concat(extension.rules.morphingRules); } if(extension.stencils) stencils = stencils.concat(extension.stencils); }); this._stencils = this._stencils.concat(stencilSet.stencils()); // init connection rules var cr = this._connectionRules; if (jsonRules.connectionRules) { jsonRules.connectionRules.each((function(rules){ if (this._isRoleOfOtherNamespace(rules.role)) { if (!cr[rules.role]) { cr[rules.role] = new Hash(); } } else { if (!cr[namespace + rules.role]) cr[namespace + rules.role] = new Hash(); } rules.connects.each((function(connect){ var toRoles = []; if (connect.to) { if (!(connect.to instanceof Array)) { connect.to = [connect.to]; } connect.to.each((function(to){ if (this._isRoleOfOtherNamespace(to)) { toRoles.push(to); } else { toRoles.push(namespace + to); } }).bind(this)); } var role, from; if (this._isRoleOfOtherNamespace(rules.role)) role = rules.role; else role = namespace + rules.role; if (this._isRoleOfOtherNamespace(connect.from)) from = connect.from; else from = namespace + connect.from; if (!cr[role][from]) cr[role][from] = toRoles; else cr[role][from] = cr[role][from].concat(toRoles); }).bind(this)); }).bind(this)); } // init cardinality rules var cardr = this._cardinalityRules; if (jsonRules.cardinalityRules) { jsonRules.cardinalityRules.each((function(rules){ var cardrKey; if (this._isRoleOfOtherNamespace(rules.role)) { cardrKey = rules.role; } else { cardrKey = namespace + rules.role; } if (!cardr[cardrKey]) { cardr[cardrKey] = {}; for (i in rules) { cardr[cardrKey][i] = rules[i]; } } var oe = new Hash(); if (rules.outgoingEdges) { rules.outgoingEdges.each((function(rule){ if (this._isRoleOfOtherNamespace(rule.role)) { oe[rule.role] = rule; } else { oe[namespace + rule.role] = rule; } }).bind(this)); } cardr[cardrKey].outgoingEdges = oe; var ie = new Hash(); if (rules.incomingEdges) { rules.incomingEdges.each((function(rule){ if (this._isRoleOfOtherNamespace(rule.role)) { ie[rule.role] = rule; } else { ie[namespace + rule.role] = rule; } }).bind(this)); } cardr[cardrKey].incomingEdges = ie; }).bind(this)); } // init containment rules var conr = this._containmentRules; if (jsonRules.containmentRules) { jsonRules.containmentRules.each((function(rules){ var conrKey; if (this._isRoleOfOtherNamespace(rules.role)) { conrKey = rules.role; } else { conrKey = namespace + rules.role; } if (!conr[conrKey]) { conr[conrKey] = []; } rules.contains.each((function(containRole){ if (this._isRoleOfOtherNamespace(containRole)) { conr[conrKey].push(containRole); } else { conr[conrKey].push(namespace + containRole); } }).bind(this)); }).bind(this)); } // init morphing rules var morphr = this._morphingRules; if (jsonRules.morphingRules) { jsonRules.morphingRules.each((function(rules){ var morphrKey; if (this._isRoleOfOtherNamespace(rules.role)) { morphrKey = rules.role; } else { morphrKey = namespace + rules.role; } if (!morphr[morphrKey]) { morphr[morphrKey] = []; } if(!rules.preserveBounds) { rules.preserveBounds = false; } rules.baseMorphs.each((function(baseMorphStencilId){ morphr[morphrKey].push(this._getStencilById(namespace + baseMorphStencilId)); }).bind(this)); }).bind(this)); } // init layouting rules var layoutRules = this._layoutRules; if (jsonRules.layoutRules) { var getDirections = function(o){ return { "edgeRole":o.edgeRole||undefined, "t": o["t"]||1, "r": o["r"]||1, "b": o["b"]||1, "l": o["l"]||1 } } jsonRules.layoutRules.each(function(rules){ var layoutKey; if (this._isRoleOfOtherNamespace(rules.role)) { layoutKey = rules.role; } else { layoutKey = namespace + rules.role; } if (!layoutRules[layoutKey]) { layoutRules[layoutKey] = {}; } if (rules["in"]){ layoutRules[layoutKey]["in"] = getDirections(rules["in"]); } if (rules["ins"]){ layoutRules[layoutKey]["ins"] = (rules["ins"]||[]).map(function(e){ return getDirections(e) }) } if (rules["out"]) { layoutRules[layoutKey]["out"] = getDirections(rules["out"]); } if (rules["outs"]){ layoutRules[layoutKey]["outs"] = (rules["outs"]||[]).map(function(e){ return getDirections(e) }) } }.bind(this)); } } }, _getStencilById: function(id) { return this._stencils.find(function(stencil) { return stencil.id()==id; }); }, _cacheConnect: function(args) { result = this._canConnect(args); if (args.sourceStencil && args.targetStencil) { var source = this._cachedConnectSET[args.sourceStencil.id()]; if(!source) { source = new Hash(); this._cachedConnectSET[args.sourceStencil.id()] = source; } var edge = source[args.edgeStencil.id()]; if(!edge) { edge = new Hash(); source[args.edgeStencil.id()] = edge; } edge[args.targetStencil.id()] = result; } else if (args.sourceStencil) { var source = this._cachedConnectSE[args.sourceStencil.id()]; if(!source) { source = new Hash(); this._cachedConnectSE[args.sourceStencil.id()] = source; } source[args.edgeStencil.id()] = result; } else { var target = this._cachedConnectTE[args.targetStencil.id()]; if(!target) { target = new Hash(); this._cachedConnectTE[args.targetStencil.id()] = target; } target[args.edgeStencil.id()] = result; } return result; }, _cacheCard: function(args) { if(args.sourceStencil) { var source = this._cachedCardSE[args.sourceStencil.id()] if(!source) { source = new Hash(); this._cachedCardSE[args.sourceStencil.id()] = source; } var max = this._getMaximumNumberOfOutgoingEdge(args); if(max == undefined) max = -1; source[args.edgeStencil.id()] = max; } if(args.targetStencil) { var target = this._cachedCardTE[args.targetStencil.id()] if(!target) { target = new Hash(); this._cachedCardTE[args.targetStencil.id()] = target; } var max = this._getMaximumNumberOfIncomingEdge(args); if(max == undefined) max = -1; target[args.edgeStencil.id()] = max; } }, _cacheContain: function(args) { var result = [this._canContain(args), this._getMaximumOccurrence(args.containingStencil, args.containedStencil)] if(result[1] == undefined) result[1] = -1; var children = this._cachedContainPC[args.containingStencil.id()]; if(!children) { children = new Hash(); this._cachedContainPC[args.containingStencil.id()] = children; } children[args.containedStencil.id()] = result; return result; }, /** * Returns all stencils belonging to a morph group. (calculation result is * cached) */ _cacheMorph: function(role) { var morphs = this._cachedMorphRS[role]; if(!morphs) { morphs = []; if(this._morphingRules.keys().include(role)) { morphs = this._stencils.select(function(stencil) { return stencil.roles().include(role); }); } this._cachedMorphRS[role] = morphs; } return morphs; }, /** Begin connection rules' methods */ /** * * @param {Object} * args sourceStencil: ORYX.Core.StencilSet.Stencil | undefined * sourceShape: ORYX.Core.Shape | undefined * * At least sourceStencil or sourceShape has to be specified * * @return {Array} Array of stencils of edges that can be outgoing edges of * the source. */ outgoingEdgeStencils: function(args) { // check arguments if(!args.sourceShape && !args.sourceStencil) { return []; } // init arguments if(args.sourceShape) { args.sourceStencil = args.sourceShape.getStencil(); } var _edges = []; // test each edge, if it can connect to source this._stencils.each((function(stencil) { if(stencil.type() === "edge") { var newArgs = Object.clone(args); newArgs.edgeStencil = stencil; if(this.canConnect(newArgs)) { _edges.push(stencil); } } }).bind(this)); return _edges; }, /** * * @param {Object} * args targetStencil: ORYX.Core.StencilSet.Stencil | undefined * targetShape: ORYX.Core.Shape | undefined * * At least targetStencil or targetShape has to be specified * * @return {Array} Array of stencils of edges that can be incoming edges of * the target. */ incomingEdgeStencils: function(args) { // check arguments if(!args.targetShape && !args.targetStencil) { return []; } // init arguments if(args.targetShape) { args.targetStencil = args.targetShape.getStencil(); } var _edges = []; // test each edge, if it can connect to source this._stencils.each((function(stencil) { if(stencil.type() === "edge") { var newArgs = Object.clone(args); newArgs.edgeStencil = stencil; if(this.canConnect(newArgs)) { _edges.push(stencil); } } }).bind(this)); return _edges; }, /** * * @param {Object} * args edgeStencil: ORYX.Core.StencilSet.Stencil | undefined * edgeShape: ORYX.Core.Edge | undefined targetStencil: * ORYX.Core.StencilSet.Stencil | undefined targetShape: * ORYX.Core.Node | undefined * * At least edgeStencil or edgeShape has to be specified!!! * * @return {Array} Returns an array of stencils that can be source of the * specified edge. */ sourceStencils: function(args) { // check arguments if(!args || !args.edgeShape && !args.edgeStencil) { return []; } // init arguments if(args.targetShape) { args.targetStencil = args.targetShape.getStencil(); } if(args.edgeShape) { args.edgeStencil = args.edgeShape.getStencil(); } var _sources = []; // check each stencil, if it can be a source this._stencils.each((function(stencil) { var newArgs = Object.clone(args); newArgs.sourceStencil = stencil; if(this.canConnect(newArgs)) { _sources.push(stencil); } }).bind(this)); return _sources; }, /** * * @param {Object} * args edgeStencil: ORYX.Core.StencilSet.Stencil | undefined * edgeShape: ORYX.Core.Edge | undefined sourceStencil: * ORYX.Core.StencilSet.Stencil | undefined sourceShape: * ORYX.Core.Node | undefined * * At least edgeStencil or edgeShape has to be specified!!! * * @return {Array} Returns an array of stencils that can be target of the * specified edge. */ targetStencils: function(args) { // check arguments if(!args || !args.edgeShape && !args.edgeStencil) { return []; } // init arguments if(args.sourceShape) { args.sourceStencil = args.sourceShape.getStencil(); } if(args.edgeShape) { args.edgeStencil = args.edgeShape.getStencil(); } var _targets = []; // check stencil, if it can be a target this._stencils.each((function(stencil) { var newArgs = Object.clone(args); newArgs.targetStencil = stencil; if(this.canConnect(newArgs)) { _targets.push(stencil); } }).bind(this)); return _targets; }, /** * * @param {Object} * args edgeStencil: ORYX.Core.StencilSet.Stencil edgeShape: * ORYX.Core.Edge |undefined sourceStencil: * ORYX.Core.StencilSet.Stencil | undefined sourceShape: * ORYX.Core.Node |undefined targetStencil: * ORYX.Core.StencilSet.Stencil | undefined targetShape: * ORYX.Core.Node |undefined * * At least source or target has to be specified!!! * * @return {Boolean} Returns, if the edge can connect source and target. */ canConnect: function(args) { // check arguments if(!args || (!args.sourceShape && !args.sourceStencil && !args.targetShape && !args.targetStencil) || !args.edgeShape && !args.edgeStencil) { return false; } // init arguments if(args.sourceShape) { args.sourceStencil = args.sourceShape.getStencil(); } if(args.targetShape) { args.targetStencil = args.targetShape.getStencil(); } if(args.edgeShape) { args.edgeStencil = args.edgeShape.getStencil(); } var result; if(args.sourceStencil && args.targetStencil) { var source = this._cachedConnectSET[args.sourceStencil.id()]; if(!source) result = this._cacheConnect(args); else { var edge = source[args.edgeStencil.id()]; if(!edge) result = this._cacheConnect(args); else { var target = edge[args.targetStencil.id()]; if(target == undefined) result = this._cacheConnect(args); else result = target; } } } else if (args.sourceStencil) { var source = this._cachedConnectSE[args.sourceStencil.id()]; if(!source) result = this._cacheConnect(args); else { var edge = source[args.edgeStencil.id()]; if(edge == undefined) result = this._cacheConnect(args); else result = edge; } } else { // args.targetStencil var target = this._cachedConnectTE[args.targetStencil.id()]; if(!target) result = this._cacheConnect(args); else { var edge = target[args.edgeStencil.id()]; if(edge == undefined) result = this._cacheConnect(args); else result = edge; } } // check cardinality if (result) { if(args.sourceShape) { var source = this._cachedCardSE[args.sourceStencil.id()]; if(!source) { this._cacheCard(args); source = this._cachedCardSE[args.sourceStencil.id()]; } var max = source[args.edgeStencil.id()]; if(max == undefined) { this._cacheCard(args); } max = source[args.edgeStencil.id()]; if(max != -1) { result = args.sourceShape.getOutgoingShapes().all(function(cs) { if((cs.getStencil().id() === args.edgeStencil.id()) && ((args.edgeShape) ? cs !== args.edgeShape : true)) { max--; return (max > 0) ? true : false; } else { return true; } }); } } if (args.targetShape) { var target = this._cachedCardTE[args.targetStencil.id()]; if(!target) { this._cacheCard(args); target = this._cachedCardTE[args.targetStencil.id()]; } var max = target[args.edgeStencil.id()]; if(max == undefined) { this._cacheCard(args); } max = target[args.edgeStencil.id()]; if(max != -1) { result = args.targetShape.getIncomingShapes().all(function(cs){ if ((cs.getStencil().id() === args.edgeStencil.id()) && ((args.edgeShape) ? cs !== args.edgeShape : true)) { max--; return (max > 0) ? true : false; } else { return true; } }); } } } return result; }, /** * * @param {Object} * args edgeStencil: ORYX.Core.StencilSet.Stencil edgeShape: * ORYX.Core.Edge |undefined sourceStencil: * ORYX.Core.StencilSet.Stencil | undefined sourceShape: * ORYX.Core.Node |undefined targetStencil: * ORYX.Core.StencilSet.Stencil | undefined targetShape: * ORYX.Core.Node |undefined * * At least source or target has to be specified!!! * * @return {Boolean} Returns, if the edge can connect source and target. */ _canConnect: function(args) { // check arguments if(!args || (!args.sourceShape && !args.sourceStencil && !args.targetShape && !args.targetStencil) || !args.edgeShape && !args.edgeStencil) { return false; } // init arguments if(args.sourceShape) { args.sourceStencil = args.sourceShape.getStencil(); } if(args.targetShape) { args.targetStencil = args.targetShape.getStencil(); } if(args.edgeShape) { args.edgeStencil = args.edgeShape.getStencil(); } // 1. check connection rules var resultCR; // get all connection rules for this edge var edgeRules = this._getConnectionRulesOfEdgeStencil(args.edgeStencil); // check connection rules, if the source can be connected to the target // with the specified edge. if(edgeRules.keys().length === 0) { resultCR = false; } else { if(args.sourceStencil) { resultCR = args.sourceStencil.roles().any(function(sourceRole) { var targetRoles = edgeRules[sourceRole]; if(!targetRoles) {return false;} if(args.targetStencil) { return (targetRoles.any(function(targetRole) { return args.targetStencil.roles().member(targetRole); })); } else { return true; } }); } else { // !args.sourceStencil -> there is args.targetStencil resultCR = edgeRules.values().any(function(targetRoles) { return args.targetStencil.roles().any(function(targetRole) { return targetRoles.member(targetRole); }); }); } } return resultCR; }, /** End connection rules' methods */ /** Begin containment rules' methods */ /** * * @param {Object} * args containingStencil: ORYX.Core.StencilSet.Stencil * containingShape: ORYX.Core.AbstractShape containedStencil: * ORYX.Core.StencilSet.Stencil containedShape: ORYX.Core.Shape */ canContain: function(args) { if(!args || !args.containingStencil && !args.containingShape || !args.containedStencil && !args.containedShape) { return false; } // init arguments if(args.containedShape) { args.containedStencil = args.containedShape.getStencil(); } if(args.containingShape) { args.containingStencil = args.containingShape.getStencil(); } //if(args.containingStencil.type() == 'edge' || args.containedStencil.type() == 'edge') // return false; if(args.containedStencil.type() == 'edge') return false; var childValues; var parent = this._cachedContainPC[args.containingStencil.id()]; if(!parent) childValues = this._cacheContain(args); else { childValues = parent[args.containedStencil.id()]; if(!childValues) childValues = this._cacheContain(args); } if(!childValues[0]) return false; else if (childValues[1] == -1) return true; else { if(args.containingShape) { var max = childValues[1]; return args.containingShape.getChildShapes(false).all(function(as) { if(as.getStencil().id() === args.containedStencil.id()) { max--; return (max > 0) ? true : false; } else { return true; } }); } else { return true; } } }, /** * * @param {Object} * args containingStencil: ORYX.Core.StencilSet.Stencil * containingShape: ORYX.Core.AbstractShape containedStencil: * ORYX.Core.StencilSet.Stencil containedShape: ORYX.Core.Shape */ _canContain: function(args) { if(!args || !args.containingStencil && !args.containingShape || !args.containedStencil && !args.containedShape) { return false; } // init arguments if(args.containedShape) { args.containedStencil = args.containedShape.getStencil(); } if(args.containingShape) { args.containingStencil = args.containingShape.getStencil(); } // if(args.containingShape) { // if(args.containingShape instanceof ORYX.Core.Edge) { // // edges cannot contain other shapes // return false; // } // } var result; // check containment rules result = args.containingStencil.roles().any((function(role) { var roles = this._containmentRules[role]; if(roles) { return roles.any(function(role) { return args.containedStencil.roles().member(role); }); } else { return false; } }).bind(this)); return result; }, /** End containment rules' methods */ /** Begin morphing rules' methods */ /** * * @param {Object} * args * stencil: ORYX.Core.StencilSet.Stencil | undefined * shape: ORYX.Core.Shape | undefined * * At least stencil or shape has to be specified * * @return {Array} Array of stencils that the passed stencil/shape can be * transformed to (including the current stencil itself) */ morphStencils: function(args) { // check arguments if(!args.stencil && !args.shape) { return []; } // init arguments if(args.shape) { args.stencil = args.shape.getStencil(); } var _morphStencils = []; args.stencil.roles().each(function(role) { this._cacheMorph(role).each(function(stencil) { _morphStencils.push(stencil); }) }.bind(this)); return _morphStencils.uniq(); }, /** * @return {Array} An array of all base morph stencils */ baseMorphs: function() { var _baseMorphs = []; this._morphingRules.each(function(pair) { pair.value.each(function(baseMorph) { _baseMorphs.push(baseMorph); }); }); return _baseMorphs; }, /** * Returns true if there are morphing rules defines * @return {boolean} */ containsMorphingRules: function(){ return this._stencilSets.any(function(ss){ return !!ss.jsonRules().morphingRules}); }, /** * * @param {Object} * args * sourceStencil: * ORYX.Core.StencilSet.Stencil | undefined * sourceShape: * ORYX.Core.Node |undefined * targetStencil: * ORYX.Core.StencilSet.Stencil | undefined * targetShape: * ORYX.Core.Node |undefined * * * @return {Stencil} Returns, the stencil for the connecting edge * or null if connection is not possible */ connectMorph: function(args) { // check arguments if(!args || (!args.sourceShape && !args.sourceStencil && !args.targetShape && !args.targetStencil)) { return false; } // init arguments if(args.sourceShape) { args.sourceStencil = args.sourceShape.getStencil(); } if(args.targetShape) { args.targetStencil = args.targetShape.getStencil(); } var incoming = this.incomingEdgeStencils(args); var outgoing = this.outgoingEdgeStencils(args); var edgeStencils = incoming.select(function(e) { return outgoing.member(e); }); // intersection of sets var baseEdgeStencils = this.baseMorphs().select(function(e) { return edgeStencils.member(e); }); // again: intersection of sets if(baseEdgeStencils.size()>0) return baseEdgeStencils[0]; // return any of the possible base morphs else if(edgeStencils.size()>0) return edgeStencils[0]; // return any of the possible stencils return null; //connection not possible }, /** * Return true if the stencil should be located in the shape menu * @param {ORYX.Core.StencilSet.Stencil} morph * @return {Boolean} Returns true if the morphs in the morph group of the * specified morph shall be displayed in the shape menu */ showInShapeMenu: function(stencil) { return this._stencilSets.any(function(ss){ return ss.jsonRules().morphingRules .any(function(r){ return stencil.roles().include(ss.namespace() + r.role) && r.showInShapeMenu !== false; }) }); }, preserveBounds: function(stencil) { return this._stencilSets.any(function(ss) { return ss.jsonRules().morphingRules.any(function(r) { return stencil.roles().include(ss.namespace() + r.role) && r.preserveBounds; }) }) }, /** End morphing rules' methods */ /** Begin layouting rules' methods */ /** * Returns a set on "in" and "out" layouting rules for a given shape * @param {Object} shape * @param {Object} edgeShape (Optional) * @return {Object} "in" and "out" with a default value of {"t":1, "r":1, "b":1, "r":1} if not specified in the json */ getLayoutingRules : function(shape, edgeShape){ if (!shape||!(shape instanceof ORYX.Core.Shape)){ return } var layout = {"in":{},"out":{}}; var parseValues = function(o, v){ if (o && o[v]){ ["t","r","b","l"].each(function(d){ layout[v][d]=Math.max(o[v][d],layout[v][d]||0); }); } if (o && o[v+"s"] instanceof Array){ ["t","r","b","l"].each(function(d){ var defaultRule = o[v+"s"].find(function(e){ return !e.edgeRole }); var edgeRule; if (edgeShape instanceof ORYX.Core.Edge) { edgeRule = o[v + "s"].find(function(e){return this._hasRole(edgeShape, e.edgeRole) }.bind(this)); } layout[v][d]=Math.max(edgeRule?edgeRule[d]:defaultRule[d],layout[v][d]||0); }.bind(this)); } }.bind(this) // For each role shape.getStencil().roles().each(function(role) { // check if there are layout information if (this._layoutRules[role]){ // if so, parse those information to the 'layout' variable parseValues(this._layoutRules[role], "in"); parseValues(this._layoutRules[role], "out"); } }.bind(this)); // Make sure, that every attribute has an value, // otherwise set 1 ["in","out"].each(function(v){ ["t","r","b","l"].each(function(d){ layout[v][d]=layout[v][d]!==undefined?layout[v][d]:1; }); }) return layout; }, /** End layouting rules' methods */ /** Helper methods */ /** * Checks wether a shape contains the given role or the role is equal the stencil id * @param {ORYX.Core.Shape} shape * @param {String} role */ _hasRole: function(shape, role){ if (!(shape instanceof ORYX.Core.Shape)||!role){ return } var isRole = shape.getStencil().roles().any(function(r){ return r == role}); return isRole || shape.getStencil().id() == (shape.getStencil().namespace()+role); }, /** * * @param {String} * role * * @return {Array} Returns an array of stencils that can act as role. */ _stencilsWithRole: function(role) { return this._stencils.findAll(function(stencil) { return (stencil.roles().member(role)) ? true : false; }); }, /** * * @param {String} * role * * @return {Array} Returns an array of stencils that can act as role and * have the type 'edge'. */ _edgesWithRole: function(role) { return this._stencils.findAll(function(stencil) { return (stencil.roles().member(role) && stencil.type() === "edge") ? true : false; }); }, /** * * @param {String} * role * * @return {Array} Returns an array of stencils that can act as role and * have the type 'node'. */ _nodesWithRole: function(role) { return this._stencils.findAll(function(stencil) { return (stencil.roles().member(role) && stencil.type() === "node") ? true : false; }); }, /** * * @param {ORYX.Core.StencilSet.Stencil} * parent * @param {ORYX.Core.StencilSet.Stencil} * child * * @returns {Boolean} Returns the maximum occurrence of shapes of the * stencil's type inside the parent. */ _getMaximumOccurrence: function(parent, child) { var max; child.roles().each((function(role) { var cardRule = this._cardinalityRules[role]; if(cardRule && cardRule.maximumOccurrence) { if(max) { max = Math.min(max, cardRule.maximumOccurrence); } else { max = cardRule.maximumOccurrence; } } }).bind(this)); return max; }, /** * * @param {Object} * args sourceStencil: ORYX.Core.Node edgeStencil: * ORYX.Core.StencilSet.Stencil * * @return {Boolean} Returns, the maximum number of outgoing edges of the * type specified by edgeStencil of the sourceShape. */ _getMaximumNumberOfOutgoingEdge: function(args) { if(!args || !args.sourceStencil || !args.edgeStencil) { return false; } var max; args.sourceStencil.roles().each((function(role) { var cardRule = this._cardinalityRules[role]; if(cardRule && cardRule.outgoingEdges) { args.edgeStencil.roles().each(function(edgeRole) { var oe = cardRule.outgoingEdges[edgeRole]; if(oe && oe.maximum) { if(max) { max = Math.min(max, oe.maximum); } else { max = oe.maximum; } } }); } }).bind(this)); return max; }, /** * * @param {Object} * args targetStencil: ORYX.Core.StencilSet.Stencil edgeStencil: * ORYX.Core.StencilSet.Stencil * * @return {Boolean} Returns the maximum number of incoming edges of the * type specified by edgeStencil of the targetShape. */ _getMaximumNumberOfIncomingEdge: function(args) { if(!args || !args.targetStencil || !args.edgeStencil) { return false; } var max; args.targetStencil.roles().each((function(role) { var cardRule = this._cardinalityRules[role]; if(cardRule && cardRule.incomingEdges) { args.edgeStencil.roles().each(function(edgeRole) { var ie = cardRule.incomingEdges[edgeRole]; if(ie && ie.maximum) { if(max) { max = Math.min(max, ie.maximum); } else { max = ie.maximum; } } }); } }).bind(this)); return max; }, /** * * @param {ORYX.Core.StencilSet.Stencil} * edgeStencil * * @return {Hash} Returns a hash map of all connection rules for * edgeStencil. */ _getConnectionRulesOfEdgeStencil: function(edgeStencil) { var edgeRules = new Hash(); edgeStencil.roles().each((function(role) { if(this._connectionRules[role]) { this._connectionRules[role].each(function(cr) { if(edgeRules[cr.key]) { edgeRules[cr.key] = edgeRules[cr.key].concat(cr.value); } else { edgeRules[cr.key] = cr.value; } }); } }).bind(this)); return edgeRules; }, _isRoleOfOtherNamespace: function(role) { return (role.indexOf("#") > 0); }, toString: function() { return "Rules"; } } ORYX.Core.StencilSet.Rules = Clazz.extend(ORYX.Core.StencilSet.Rules);
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/rules.js
JavaScript
mit
36,085
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespace */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};} /** * Class Stencil * uses Prototpye 1.5.0 * uses Inheritance * * This class represents one stencil of a stencil set. */ ORYX.Core.StencilSet.Stencil = { /** * Constructor */ construct: function(jsonStencil, namespace, source, stencilSet, propertyPackages, defaultPosition) { arguments.callee.$.construct.apply(this, arguments); // super(); // check arguments and set defaults. if(!jsonStencil) throw "Stencilset seems corrupt."; if(!namespace) throw "Stencil does not provide namespace."; if(!source) throw "Stencil does not provide SVG source."; if(!stencilSet) throw "Fatal internal error loading stencilset."; //if(!propertyPackages) throw "Fatal internal error loading stencilset."; this._source = source; this._jsonStencil = jsonStencil; this._stencilSet = stencilSet; this._namespace = namespace; this._propertyPackages = propertyPackages; if(defaultPosition && !this._jsonStencil.position) this._jsonStencil.position = defaultPosition; this._view; this._properties = new Hash(); // check stencil consistency and set defaults. /*with(this._jsonStencil) { if(!type) throw "Stencil does not provide type."; if((type != "edge") && (type != "node")) throw "Stencil type must be 'edge' or 'node'."; if(!id || id == "") throw "Stencil does not provide valid id."; if(!title || title == "") throw "Stencil does not provide title"; if(!description) { description = ""; }; if(!groups) { groups = []; } if(!roles) { roles = []; } // add id of stencil to its roles roles.push(id); }*/ //init all JSON values if(!this._jsonStencil.type || !(this._jsonStencil.type === "edge" || this._jsonStencil.type === "node")) { throw "ORYX.Core.StencilSet.Stencil(construct): Type is not defined."; } if(!this._jsonStencil.id || this._jsonStencil.id === "") { throw "ORYX.Core.StencilSet.Stencil(construct): Id is not defined."; } if(!this._jsonStencil.title || this._jsonStencil.title === "") { throw "ORYX.Core.StencilSet.Stencil(construct): Title is not defined."; } if(!this._jsonStencil.description) { this._jsonStencil.description = ""; }; if(!this._jsonStencil.groups) { this._jsonStencil.groups = []; } if(!this._jsonStencil.roles) { this._jsonStencil.roles = []; } //add id of stencil to its roles this._jsonStencil.roles.push(this._jsonStencil.id); //prepend namespace to each role this._jsonStencil.roles.each((function(role, index) { this._jsonStencil.roles[index] = namespace + role; }).bind(this)); //delete duplicate roles this._jsonStencil.roles = this._jsonStencil.roles.uniq(); //make id unique by prepending namespace of stencil set this._jsonStencil.id = namespace + this._jsonStencil.id; this.postProcessProperties(); // init serialize callback if(!this._jsonStencil.serialize) { this._jsonStencil.serialize = {}; //this._jsonStencil.serialize = function(shape, data) { return data;}; } // init deserialize callback if(!this._jsonStencil.deserialize) { this._jsonStencil.deserialize = {}; //this._jsonStencil.deserialize = function(shape, data) { return data;}; } // init layout callback if(!this._jsonStencil.layout) { this._jsonStencil.layout = [] //this._jsonStencil.layout = function() {return true;} } //TODO does not work correctly, if the url does not exist //How to guarantee that the view is loaded correctly before leaving the constructor??? var url = source + "view/" + jsonStencil.view; // override content type when this is webkit. /* if(Prototype.Browser.WebKit) { var req = new XMLHttpRequest; req.open("GET", url, false); req.overrideMimeType('text/xml'); req.send(null); req.onload = (function() { _loadSVGOnSuccess(req.responseXML); }).bind(this); // else just do it. } else */ if(this._jsonStencil.view.trim().match(/</)) { var parser = new DOMParser(); var xml = parser.parseFromString( this._jsonStencil.view ,"text/xml"); //check if result is a SVG document if( ORYX.Editor.checkClassType( xml.documentElement, SVGSVGElement )) { this._view = xml.documentElement; //updating link to images var imageElems = this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg", "image"); $A(imageElems).each((function(imageElem) { var link = imageElem.getAttributeNodeNS("http://www.w3.org/1999/xlink", "href"); if(link && link.value.indexOf("://") == -1) { link.textContent = this._source + "view/" + link.value; } }).bind(this)); } else { throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document." } } else { new Ajax.Request( url, { asynchronous:false, method:'get', onSuccess:this._loadSVGOnSuccess.bind(this), onFailure:this._loadSVGOnFailure.bind(this) }); } }, postProcessProperties: function() { // add image path to icon if(this._jsonStencil.icon && this._jsonStencil.icon.indexOf("://") === -1) { this._jsonStencil.icon = this._source + "icons/" + this._jsonStencil.icon; } else { this._jsonStencil.icon = ""; } // init property packages if(this._jsonStencil.propertyPackages && this._jsonStencil.propertyPackages instanceof Array) { this._jsonStencil.propertyPackages.each((function(ppId) { var pp = this._propertyPackages[ppId]; if(pp) { pp.each((function(prop){ var oProp = new ORYX.Core.StencilSet.Property(prop, this._namespace, this); this._properties[oProp.prefix() + "-" + oProp.id()] = oProp; }).bind(this)); } }).bind(this)); } // init properties if(this._jsonStencil.properties && this._jsonStencil.properties instanceof Array) { this._jsonStencil.properties.each((function(prop) { var oProp = new ORYX.Core.StencilSet.Property(prop, this._namespace, this); this._properties[oProp.prefix() + "-" + oProp.id()] = oProp; }).bind(this)); } }, /** * @param {ORYX.Core.StencilSet.Stencil} stencil * @return {Boolean} True, if stencil has the same namespace and type. */ equals: function(stencil) { return (this.id() === stencil.id()); }, stencilSet: function() { return this._stencilSet; }, type: function() { return this._jsonStencil.type; }, namespace: function() { return this._namespace; }, id: function() { return this._jsonStencil.id; }, idWithoutNs: function(){ return this.id().replace(this.namespace(),""); }, title: function() { return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "title"); }, description: function() { return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "description"); }, groups: function() { return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "groups"); }, position: function() { return (isNaN(this._jsonStencil.position) ? 0 : this._jsonStencil.position); }, view: function() { return this._view.cloneNode(true) || this._view; }, icon: function() { return this._jsonStencil.icon; }, bigIcon: function bigIcon() { var bigIconURL = this.icon(); var bigIconURLStart = bigIconURL.slice(0, bigIconURL.length - 4); var bigIconURLEnd = bigIconURL.slice(bigIconURL.length - 4, bigIconURL.length); var bigIconURL = bigIconURLStart + "-32" + bigIconURLEnd; return bigIconURL; }, fixedAspectRatio: function() { return this._jsonStencil.fixedAspectRatio === true; }, hasMultipleRepositoryEntries: function() { return (this.getRepositoryEntries().length > 0); }, getRepositoryEntries: function() { return (this._jsonStencil.repositoryEntries) ? $A(this._jsonStencil.repositoryEntries) : $A([]); }, properties: function() { return this._properties.values(); }, property: function(id) { return this._properties[id]; }, roles: function() { return this._jsonStencil.roles; }, defaultAlign: function() { if(!this._jsonStencil.defaultAlign) return "east"; return this._jsonStencil.defaultAlign; }, serialize: function(shape, data) { return this._jsonStencil.serialize; //return this._jsonStencil.serialize(shape, data); }, deserialize: function(shape, data) { return this._jsonStencil.deserialize; //return this._jsonStencil.deserialize(shape, data); }, // in which case is targetShape used? // layout: function(shape, targetShape) { // return this._jsonStencil.layout(shape, targetShape); // }, // layout property to store events for layouting in plugins layout: function(shape) { return this._jsonStencil.layout }, addProperty: function(property, namespace) { if(property && namespace) { var oProp = new ORYX.Core.StencilSet.Property(property, namespace, this); this._properties[oProp.prefix() + "-" + oProp.id()] = oProp; } }, removeProperty: function(propertyId) { if(propertyId) { var oProp = this._properties.values().find(function(prop) { return (propertyId == prop.id()); }); if(oProp) delete this._properties[oProp.prefix() + "-" + oProp.id()]; } }, _loadSVGOnSuccess: function(result) { var xml = null; /* * We want to get a dom object for the requested file. Unfortunately, * safari has some issues here. this is meant as a fallback for all * browsers that don't recognize the svg mimetype as XML but support * data: urls on Ajax calls. */ // responseXML != undefined. // if(!(result.responseXML)) // get the dom by data: url. // xml = _evenMoreEvilHack(result.responseText, 'text/xml'); // else // get it the usual way. xml = result.responseXML; //check if result is a SVG document if( ORYX.Editor.checkClassType( xml.documentElement, SVGSVGElement )) { this._view = xml.documentElement; //updating link to images var imageElems = this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg", "image"); $A(imageElems).each((function(imageElem) { var link = imageElem.getAttributeNodeNS("http://www.w3.org/1999/xlink", "href"); if(link && link.value.indexOf("://") == -1) { link.textContent = this._source + "view/" + link.value; } }).bind(this)); } else { throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document." } }, _loadSVGOnFailure: function(result) { throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnFailure): Loading SVG document failed." }, toString: function() { return "Stencil " + this.title() + " (" + this.id() + ")"; } }; ORYX.Core.StencilSet.Stencil = Clazz.extend(ORYX.Core.StencilSet.Stencil); /** * Transform a string into an xml document, the Safari way, as long as * the nightlies are broken. Even more evil version. * @param {Object} str * @param {Object} contentType */ function _evenMoreEvilHack(str, contentType) { /* * This even more evil hack was taken from * http://web-graphics.com/mtarchive/001606.php#chatty004999 */ if (window.ActiveXObject) { var d = new ActiveXObject("MSXML.DomDocument"); d.loadXML(str); return d; } else if (window.XMLHttpRequest) { var req = new XMLHttpRequest; req.open("GET", "data:" + (contentType || "application/xml") + ";charset=utf-8," + encodeURIComponent(str), false); if (req.overrideMimeType) { req.overrideMimeType(contentType); } req.send(null); return req.responseXML; } } /** * Transform a string into an xml document, the Safari way, as long as * the nightlies are broken. * @param {Object} result the xml document object. */ function _evilSafariHack(serializedXML) { /* * The Dave way. Taken from: * http://web-graphics.com/mtarchive/001606.php * * There is another possibility to parse XML in Safari, by implementing * the DOMParser in javascript. However, in the latest nightlies of * WebKit, DOMParser is already available, but still buggy. So, this is * the best compromise for the time being. */ var xml = serializedXML; var url = "data:text/xml;charset=utf-8," + encodeURIComponent(xml); var dom = null; // your standard AJAX stuff var req = new XMLHttpRequest(); req.open("GET", url); req.onload = function() { dom = req.responseXML; } req.send(null); return dom; }
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/stencil.js
JavaScript
mit
14,263
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};} /** * Class Stencil * uses Prototpye 1.5.0 * uses Inheritance */ ORYX.Core.StencilSet.ComplexPropertyItem = Clazz.extend({ /** * Constructor */ construct: function(jsonItem, namespace, property) { arguments.callee.$.construct.apply(this, arguments); if(!jsonItem) { throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter jsonItem is not defined."; } if(!namespace) { throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter namespace is not defined."; } if(!property) { throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter property is not defined."; } this._jsonItem = jsonItem; this._namespace = namespace; this._property = property; this._items = new Hash(); //init all values if(!jsonItem.name) { throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Name is not defined."; } if(!jsonItem.type) { throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Type is not defined."; } else { jsonItem.type = jsonItem.type.toLowerCase(); } if(jsonItem.type === ORYX.CONFIG.TYPE_CHOICE) { if(jsonItem.items && jsonItem.items instanceof Array) { jsonItem.items.each((function(item) { this._items[item.value] = new ORYX.Core.StencilSet.PropertyItem(item, namespace, this); }).bind(this)); } else { throw "ORYX.Core.StencilSet.Property(construct): No property items defined." } } }, /** * @param {ORYX.Core.StencilSet.PropertyItem} item * @return {Boolean} True, if item has the same namespace and id. */ equals: function(item) { return (this.property().equals(item.property()) && this.name() === item.name()); }, namespace: function() { return this._namespace; }, property: function() { return this._property; }, name: function() { return ORYX.Core.StencilSet.getTranslation(this._jsonItem, "name"); }, id: function() { return this._jsonItem.id; }, type: function() { return this._jsonItem.type; }, optional: function() { return this._jsonItem.optional; }, width: function() { return this._jsonItem.width; }, value: function() { return this._jsonItem.value; }, items: function() { return this._items.values(); }, disable: function() { return this._jsonItem.disable; } });
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/complexpropertyitem.js
JavaScript
mit
4,012
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespace */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};} /** * Class StencilSets * uses Prototpye 1.5.0 * uses Inheritance * * Singleton */ //storage for loaded stencil sets by namespace ORYX.Core.StencilSet._stencilSetsByNamespace = new Hash(); //storage for stencil sets by url ORYX.Core.StencilSet._stencilSetsByUrl = new Hash(); //storage for stencil set namespaces by editor instances ORYX.Core.StencilSet._StencilSetNSByEditorInstance = new Hash(); //storage for rules by editor instances ORYX.Core.StencilSet._rulesByEditorInstance = new Hash(); /** * * @param {String} editorId * * @return {Hash} Returns a hash map with all stencil sets that are loaded by * the editor with the editorId. */ ORYX.Core.StencilSet.stencilSets = function(editorId) { var stencilSetNSs = ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId]; var stencilSets = new Hash(); if(stencilSetNSs) { stencilSetNSs.each(function(stencilSetNS) { var stencilSet = ORYX.Core.StencilSet.stencilSet(stencilSetNS) stencilSets[stencilSet.namespace()] = stencilSet; }); } return stencilSets; }; /** * * @param {String} namespace * * @return {ORYX.Core.StencilSet.StencilSet} Returns the stencil set with the specified * namespace. * * The method can handle namespace strings like * http://www.example.org/stencilset * http://www.example.org/stencilset# * http://www.example.org/stencilset#ANode */ ORYX.Core.StencilSet.stencilSet = function(namespace) { ORYX.Log.trace("Getting stencil set %0", namespace); var splitted = namespace.split("#", 1); if(splitted.length === 1) { ORYX.Log.trace("Getting stencil set %0", splitted[0]); return ORYX.Core.StencilSet._stencilSetsByNamespace[splitted[0] + "#"]; } else { return undefined; } }; /** * * @param {String} id * * @return {ORYX.Core.StencilSet.Stencil} Returns the stencil specified by the id. * * The id must be unique and contains the namespace of the stencil's stencil set. * e.g. http://www.example.org/stencilset#ANode */ ORYX.Core.StencilSet.stencil = function(id) { ORYX.Log.trace("Getting stencil for %0", id); var ss = ORYX.Core.StencilSet.stencilSet(id); if(ss) { return ss.stencil(id); } else { ORYX.Log.trace("Cannot fild stencil for %0", id); return undefined; } }; /** * * @param {String} editorId * * @return {ORYX.Core.StencilSet.Rules} Returns the rules object for the editor * specified by its editor id. */ ORYX.Core.StencilSet.rules = function(editorId) { if(!ORYX.Core.StencilSet._rulesByEditorInstance[editorId]) { ORYX.Core.StencilSet._rulesByEditorInstance[editorId] = new ORYX.Core.StencilSet.Rules();; } return ORYX.Core.StencilSet._rulesByEditorInstance[editorId]; }; /** * * @param {String} url * @param {String} editorId * * Loads a stencil set from url, if it is not already loaded. * It also stores which editor instance loads the stencil set and * initializes the Rules object for the editor instance. */ ORYX.Core.StencilSet.loadStencilSet = function(url, editorId) { var stencilSet = ORYX.Core.StencilSet._stencilSetsByUrl[url]; if(!stencilSet) { //load stencil set stencilSet = new ORYX.Core.StencilSet.StencilSet(url); //store stencil set ORYX.Core.StencilSet._stencilSetsByNamespace[stencilSet.namespace()] = stencilSet; //store stencil set by url ORYX.Core.StencilSet._stencilSetsByUrl[url] = stencilSet; } var namespace = stencilSet.namespace(); //store which editorInstance loads the stencil set if(ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId]) { ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId].push(namespace); } else { ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId] = [namespace]; } //store the rules for the editor instance if(ORYX.Core.StencilSet._rulesByEditorInstance[editorId]) { ORYX.Core.StencilSet._rulesByEditorInstance[editorId].initializeRules(stencilSet); } else { var rules = new ORYX.Core.StencilSet.Rules(); rules.initializeRules(stencilSet); ORYX.Core.StencilSet._rulesByEditorInstance[editorId] = rules; } }; /** * Returns the translation of an attribute in jsonObject specified by its name * according to navigator.language */ ORYX.Core.StencilSet.getTranslation = function(jsonObject, name) { var lang = ORYX.I18N.Language.toLowerCase(); var result = jsonObject[name + "_" + lang]; if(result) return result; result = jsonObject[name + "_" + lang.substr(0, 2)]; if(result) return result; return jsonObject[name]; };
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/stencilsets.js
JavaScript
mit
6,276
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespace */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};} /** * Class Stencil * uses Prototpye 1.5.0 * uses Inheritance */ ORYX.Core.StencilSet.PropertyItem = Clazz.extend({ /** * Constructor */ construct: function(jsonItem, namespace, property) { arguments.callee.$.construct.apply(this, arguments); if(!jsonItem) { throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter jsonItem is not defined."; } if(!namespace) { throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter namespace is not defined."; } if(!property) { throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter property is not defined."; } this._jsonItem = jsonItem; this._namespace = namespace; this._property = property; //init all values if(!jsonItem.value) { throw "ORYX.Core.StencilSet.PropertyItem(construct): Value is not defined."; } if(this._jsonItem.refToView) { if(!(this._jsonItem.refToView instanceof Array)) { this._jsonItem.refToView = [this._jsonItem.refToView]; } } else { this._jsonItem.refToView = []; } }, /** * @param {ORYX.Core.StencilSet.PropertyItem} item * @return {Boolean} True, if item has the same namespace and id. */ equals: function(item) { return (this.property().equals(item.property()) && this.value() === item.value()); }, namespace: function() { return this._namespace; }, property: function() { return this._property; }, value: function() { return this._jsonItem.value; }, title: function() { return ORYX.Core.StencilSet.getTranslation(this._jsonItem, "title"); }, refToView: function() { return this._jsonItem.refToView; }, icon: function() { return (this._jsonItem.icon) ? this.property().stencil()._source + "icons/" + this._jsonItem.icon : ""; }, toString: function() { return "PropertyItem " + this.property() + " (" + this.value() + ")"; } });
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/propertyitem.js
JavaScript
mit
3,535
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespace */ if (!ORYX) { var ORYX = {}; } if (!ORYX.Core) { ORYX.Core = {}; } if (!ORYX.Core.StencilSet) { ORYX.Core.StencilSet = {}; } /** * Class Property * uses Prototpye 1.5.0 * uses Inheritance */ ORYX.Core.StencilSet.Property = Clazz.extend({ /** * Constructor */ construct: function(jsonProp, namespace, stencil){ arguments.callee.$.construct.apply(this, arguments); this._jsonProp = jsonProp || ORYX.Log.error("Parameter jsonProp is not defined."); this._namespace = namespace || ORYX.Log.error("Parameter namespace is not defined."); this._stencil = stencil || ORYX.Log.error("Parameter stencil is not defined."); this._items = new Hash(); this._complexItems = new Hash(); jsonProp.id = jsonProp.id || ORYX.Log.error("ORYX.Core.StencilSet.Property(construct): Id is not defined."); jsonProp.id = jsonProp.id.toLowerCase(); if (!jsonProp.type) { ORYX.Log.info("Type is not defined for stencil '%0', id '%1'. Falling back to 'String'.", stencil, jsonProp.id); jsonProp.type = "string"; } else { jsonProp.type = jsonProp.type.toLowerCase(); } jsonProp.prefix = jsonProp.prefix || "oryx"; jsonProp.title = jsonProp.title || ""; jsonProp.value = jsonProp.value || ""; jsonProp.description = jsonProp.description || ""; jsonProp.readonly = jsonProp.readonly || false; if(jsonProp.optional != false) jsonProp.optional = true; //init refToView if (this._jsonProp.refToView) { if (!(this._jsonProp.refToView instanceof Array)) { this._jsonProp.refToView = [this._jsonProp.refToView]; } } else { this._jsonProp.refToView = []; } if (jsonProp.min === undefined || jsonProp.min === null) { jsonProp.min = Number.MIN_VALUE; } if (jsonProp.max === undefined || jsonProp.max === null) { jsonProp.max = Number.MAX_VALUE; } if (!jsonProp.fillOpacity) { jsonProp.fillOpacity = false; } if (!jsonProp.strokeOpacity) { jsonProp.strokeOpacity = false; } if (jsonProp.length === undefined || jsonProp.length === null) { jsonProp.length = Number.MAX_VALUE; } if (!jsonProp.wrapLines) { jsonProp.wrapLines = false; } if (!jsonProp.dateFormat) { jsonProp.dataFormat = "m/d/y"; } if (!jsonProp.fill) { jsonProp.fill = false; } if (!jsonProp.stroke) { jsonProp.stroke = false; } if(!jsonProp.inverseBoolean) { jsonProp.inverseBoolean = false; } if(!jsonProp.directlyEditable && jsonProp.directlyEditable != false) { jsonProp.directlyEditable = true; } if(jsonProp.visible !== false) { jsonProp.visible = true; } if(!jsonProp.popular) { jsonProp.popular = false; } if (jsonProp.type === ORYX.CONFIG.TYPE_CHOICE) { if (jsonProp.items && jsonProp.items instanceof Array) { jsonProp.items.each((function(jsonItem){ // why is the item's value used as the key??? this._items[jsonItem.value] = new ORYX.Core.StencilSet.PropertyItem(jsonItem, namespace, this); }).bind(this)); } else { throw "ORYX.Core.StencilSet.Property(construct): No property items defined." } // extended by Kerstin (start) } else if (jsonProp.type === ORYX.CONFIG.TYPE_COMPLEX) { if (jsonProp.complexItems && jsonProp.complexItems instanceof Array) { jsonProp.complexItems.each((function(jsonComplexItem){ this._complexItems[jsonComplexItem.id] = new ORYX.Core.StencilSet.ComplexPropertyItem(jsonComplexItem, namespace, this); }).bind(this)); } else { throw "ORYX.Core.StencilSet.Property(construct): No complex property items defined." } } // extended by Kerstin (end) }, /** * @param {ORYX.Core.StencilSet.Property} property * @return {Boolean} True, if property has the same namespace and id. */ equals: function(property){ return (this._namespace === property.namespace() && this.id() === property.id()) ? true : false; }, namespace: function(){ return this._namespace; }, stencil: function(){ return this._stencil; }, id: function(){ return this._jsonProp.id; }, prefix: function(){ return this._jsonProp.prefix; }, type: function(){ return this._jsonProp.type; }, inverseBoolean: function() { return this._jsonProp.inverseBoolean; }, popular: function() { return this._jsonProp.popular; }, setPopular: function() { this._jsonProp.popular = true; }, directlyEditable: function() { return this._jsonProp.directlyEditable; }, visible: function() { return this._jsonProp.visible; }, title: function(){ return ORYX.Core.StencilSet.getTranslation(this._jsonProp, "title"); }, value: function(){ return this._jsonProp.value; }, readonly: function(){ return this._jsonProp.readonly; }, optional: function(){ return this._jsonProp.optional; }, description: function(){ return ORYX.Core.StencilSet.getTranslation(this._jsonProp, "description"); }, /** * An optional link to a SVG element so that the property affects the * graphical representation of the stencil. */ refToView: function(){ return this._jsonProp.refToView; }, /** * If type is integer or float, min is the lower bounds of value. */ min: function(){ return this._jsonProp.min; }, /** * If type ist integer or float, max is the upper bounds of value. */ max: function(){ return this._jsonProp.max; }, /** * If type is float, this method returns if the fill-opacity property should * be set. * @return {Boolean} */ fillOpacity: function(){ return this._jsonProp.fillOpacity; }, /** * If type is float, this method returns if the stroke-opacity property should * be set. * @return {Boolean} */ strokeOpacity: function(){ return this._jsonProp.strokeOpacity; }, /** * If type is string or richtext, length is the maximum length of the text. * TODO how long can a string be. */ length: function(){ return this._jsonProp.length ? this._jsonProp.length : Number.MAX_VALUE; }, wrapLines: function(){ return this._jsonProp.wrapLines; }, /** * If type is date, dateFormat specifies the format of the date. The format * specification of the ext library is used: * * Format Output Description * ------ ---------- -------------------------------------------------------------- * d 10 Day of the month, 2 digits with leading zeros * D Wed A textual representation of a day, three letters * j 10 Day of the month without leading zeros * l Wednesday A full textual representation of the day of the week * S th English ordinal day of month suffix, 2 chars (use with j) * w 3 Numeric representation of the day of the week * z 9 The julian date, or day of the year (0-365) * W 01 ISO-8601 2-digit week number of year, weeks starting on Monday (00-52) * F January A full textual representation of the month * m 01 Numeric representation of a month, with leading zeros * M Jan Month name abbreviation, three letters * n 1 Numeric representation of a month, without leading zeros * t 31 Number of days in the given month * L 0 Whether its a leap year (1 if it is a leap year, else 0) * Y 2007 A full numeric representation of a year, 4 digits * y 07 A two digit representation of a year * a pm Lowercase Ante meridiem and Post meridiem * A PM Uppercase Ante meridiem and Post meridiem * g 3 12-hour format of an hour without leading zeros * G 15 24-hour format of an hour without leading zeros * h 03 12-hour format of an hour with leading zeros * H 15 24-hour format of an hour with leading zeros * i 05 Minutes with leading zeros * s 01 Seconds, with leading zeros * O -0600 Difference to Greenwich time (GMT) in hours * T CST Timezone setting of the machine running the code * Z -21600 Timezone offset in seconds (negative if west of UTC, positive if east) * * Example: * F j, Y, g:i a -> January 10, 2007, 3:05 pm */ dateFormat: function(){ return this._jsonProp.dateFormat; }, /** * If type is color, this method returns if the fill property should * be set. * @return {Boolean} */ fill: function(){ return this._jsonProp.fill; }, /** * If type is color, this method returns if the stroke property should * be set. * @return {Boolean} */ stroke: function(){ return this._jsonProp.stroke; }, /** * If type is choice, items is a hash map with all alternative values * (PropertyItem objects) with id as keys. */ items: function(){ return this._items.values(); }, item: function(value){ return this._items[value]; }, toString: function(){ return "Property " + this.title() + " (" + this.id() + ")"; }, // extended by Kerstin (start) complexItems: function(){ return this._complexItems.values(); }, complexItem: function(id){ return this._complexItems[id]; }, // extended by Kerstin (end) complexAttributeToView: function(){ return this._jsonProp.complexAttributeToView || ""; } });
08to09-processwave
oryx/editor/client/scripts/Core/StencilSet/property.js
JavaScript
mit
12,646
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} /** * MinMaxPathHandler * * Determine the minimum and maximum of a SVG path's absolute coordinates. * For relative coordinates the absolute value is computed for consideration. * The values are stored in attributes minX, minY, maxX, and maxY. * * @constructor */ ORYX.Core.SVG.MinMaxPathHandler = Clazz.extend({ construct: function() { arguments.callee.$.construct.apply(this, arguments); this.minX = undefined; this.minY = undefined; this.maxX = undefined; this.maxY = undefined; this._lastAbsX = undefined; this._lastAbsY = undefined; }, /** * Store minimal and maximal coordinates of passed points to attributes minX, maxX, minY, maxY * * @param {Array} points Array of absolutePoints */ calculateMinMax: function(points) { if(points instanceof Array) { var x, y; for(var i = 0; i < points.length; i++) { x = parseFloat(points[i]); i++; y = parseFloat(points[i]); this.minX = (this.minX !== undefined) ? Math.min(this.minX, x) : x; this.maxX = (this.maxX !== undefined) ? Math.max(this.maxX, x) : x; this.minY = (this.minY !== undefined) ? Math.min(this.minY, y) : y; this.maxY = (this.maxY !== undefined) ? Math.max(this.maxY, y) : y; this._lastAbsX = x; this._lastAbsY = y; } } else { //TODO error } }, /** * arcAbs - A * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { this.calculateMinMax([x, y]); }, /** * arcRel - a * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoCubicAbs - C * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicAbs: function(x1, y1, x2, y2, x, y) { this.calculateMinMax([x1, y1, x2, y2, x, y]); }, /** * curvetoCubicRel - c * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicRel: function(x1, y1, x2, y2, x, y) { this.calculateMinMax([this._lastAbsX + x1, this._lastAbsY + y1, this._lastAbsX + x2, this._lastAbsY + y2, this._lastAbsX + x, this._lastAbsY + y]); }, /** * linetoHorizontalAbs - H * * @param {Number} x */ linetoHorizontalAbs: function(x) { this.calculateMinMax([x, this._lastAbsY]); }, /** * linetoHorizontalRel - h * * @param {Number} x */ linetoHorizontalRel: function(x) { this.calculateMinMax([this._lastAbsX + x, this._lastAbsY]); }, /** * linetoAbs - L * * @param {Number} x * @param {Number} y */ linetoAbs: function(x, y) { this.calculateMinMax([x, y]); }, /** * linetoRel - l * * @param {Number} x * @param {Number} y */ linetoRel: function(x, y) { this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]); }, /** * movetoAbs - M * * @param {Number} x * @param {Number} y */ movetoAbs: function(x, y) { this.calculateMinMax([x, y]); }, /** * movetoRel - m * * @param {Number} x * @param {Number} y */ movetoRel: function(x, y) { if(this._lastAbsX && this._lastAbsY) { this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]); } else { this.calculateMinMax([x, y]); } }, /** * curvetoQuadraticAbs - Q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticAbs: function(x1, y1, x, y) { this.calculateMinMax([x1, y1, x, y]); }, /** * curvetoQuadraticRel - q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticRel: function(x1, y1, x, y) { this.calculateMinMax([this._lastAbsX + x1, this._lastAbsY + y1, this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoCubicSmoothAbs - S * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothAbs: function(x2, y2, x, y) { this.calculateMinMax([x2, y2, x, y]); }, /** * curvetoCubicSmoothRel - s * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothRel: function(x2, y2, x, y) { this.calculateMinMax([this._lastAbsX + x2, this._lastAbsY + y2, this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoQuadraticSmoothAbs - T * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothAbs: function(x, y) { this.calculateMinMax([x, y]); }, /** * curvetoQuadraticSmoothRel - t * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothRel: function(x, y) { this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]); }, /** * linetoVerticalAbs - V * * @param {Number} y */ linetoVerticalAbs: function(y) { this.calculateMinMax([this._lastAbsX, y]); }, /** * linetoVerticalRel - v * * @param {Number} y */ linetoVerticalRel: function(y) { this.calculateMinMax([this._lastAbsX, this._lastAbsY + y]); }, /** * closePath - z or Z */ closePath: function() { return;// do nothing } });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/minmaxpathhandler.js
JavaScript
mit
7,495
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} /** * PathHandler * * Determine absolute points of a SVG path. The coordinates are stored * sequentially in the attribute points (x-coordinates at even indices, * y-coordinates at odd indices). * * @constructor */ ORYX.Core.SVG.PointsPathHandler = Clazz.extend({ construct: function() { arguments.callee.$.construct.apply(this, arguments); this.points = []; this._lastAbsX = undefined; this._lastAbsY = undefined; }, /** * addPoints * * @param {Array} points Array of absolutePoints */ addPoints: function(points) { if(points instanceof Array) { var x, y; for(var i = 0; i < points.length; i++) { x = parseFloat(points[i]); i++; y = parseFloat(points[i]); this.points.push(x); this.points.push(y); //this.points.push({x:x, y:y}); this._lastAbsX = x; this._lastAbsY = y; } } else { //TODO error } }, /** * arcAbs - A * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { this.addPoints([x, y]); }, /** * arcRel - a * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoCubicAbs - C * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicAbs: function(x1, y1, x2, y2, x, y) { this.addPoints([x, y]); }, /** * curvetoCubicRel - c * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicRel: function(x1, y1, x2, y2, x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * linetoHorizontalAbs - H * * @param {Number} x */ linetoHorizontalAbs: function(x) { this.addPoints([x, this._lastAbsY]); }, /** * linetoHorizontalRel - h * * @param {Number} x */ linetoHorizontalRel: function(x) { this.addPoints([this._lastAbsX + x, this._lastAbsY]); }, /** * linetoAbs - L * * @param {Number} x * @param {Number} y */ linetoAbs: function(x, y) { this.addPoints([x, y]); }, /** * linetoRel - l * * @param {Number} x * @param {Number} y */ linetoRel: function(x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * movetoAbs - M * * @param {Number} x * @param {Number} y */ movetoAbs: function(x, y) { this.addPoints([x, y]); }, /** * movetoRel - m * * @param {Number} x * @param {Number} y */ movetoRel: function(x, y) { if(this._lastAbsX && this._lastAbsY) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); } else { this.addPoints([x, y]); } }, /** * curvetoQuadraticAbs - Q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticAbs: function(x1, y1, x, y) { this.addPoints([x, y]); }, /** * curvetoQuadraticRel - q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticRel: function(x1, y1, x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoCubicSmoothAbs - S * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothAbs: function(x2, y2, x, y) { this.addPoints([x, y]); }, /** * curvetoCubicSmoothRel - s * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothRel: function(x2, y2, x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * curvetoQuadraticSmoothAbs - T * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothAbs: function(x, y) { this.addPoints([x, y]); }, /** * curvetoQuadraticSmoothRel - t * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothRel: function(x, y) { this.addPoints([this._lastAbsX + x, this._lastAbsY + y]); }, /** * linetoVerticalAbs - V * * @param {Number} y */ linetoVerticalAbs: function(y) { this.addPoints([this._lastAbsX, y]); }, /** * linetoVerticalRel - v * * @param {Number} y */ linetoVerticalRel: function(y) { this.addPoints([this._lastAbsX, this._lastAbsY + y]); }, /** * closePath - z or Z */ closePath: function() { return;// do nothing } });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/pointspathhandler.js
JavaScript
mit
6,739
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} /** * @classDescription Class for adding text to a shape. * */ ORYX.Core.SVG.Labels = []; ORYX.Core.SVG.Label = Clazz.extend({ _characterSets:[ "%W", "@", "m", "wDGMOQÖ#+=<>~^", "ABCHKNRSUVXZÜÄ&", "bdghnopquxöüETY1234567890ß_§${}*´`µ€", "aeksvyzäFLP?°²³", "c-", "rtJ\"/()[]:;!|\\", "fjI., ", "'", "il" ], _characterSetValues:[15,14,13,11,10,9,8,7,6,5,4,3], /** * Constructor * @param options {Object} : * textElement * */ construct: function(options) { arguments.callee.$.construct.apply(this, arguments); ORYX.Core.SVG.Labels.push(this); if(!options.textElement) { throw "Label: No parameter textElement." } else if (!ORYX.Editor.checkClassType( options.textElement, SVGTextElement ) ) { throw "Label: Parameter textElement is not an SVGTextElement." } this.invisibleRenderPoint = -5000; this.node = options.textElement; // should in place editing be activated? this.editable = (typeof options.editable === "undefined") ? false : options.editable; this.eventHandler = options.eventHandler; this.node.setAttributeNS(null, 'stroke-width', '0pt'); this.node.setAttributeNS(null, 'letter-spacing', '-0.01px'); this.shapeId = options.shapeId; this.id; this.fitToElemId; this.edgePosition; this.x; this.y; this.oldX; this.oldY; this.isVisible = true; this._text; this._verticalAlign; this._horizontalAlign; this._rotate; this._rotationPoint; //this.anchors = []; this.anchorLeft; this.anchorRight; this.anchorTop; this.anchorBottom; this._isChanged = true; //if the text element already has an id, don't change it. var _id = this.node.getAttributeNS(null, 'id'); if(_id) { this.id = _id; } //initialization //set referenced element the text is fit to this.fitToElemId = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'fittoelem'); if(this.fitToElemId) this.fitToElemId = this.shapeId + this.fitToElemId; //set alignment var alignValues = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align'); if(alignValues) { alignValues = alignValues.replace(/,/g, " "); alignValues = alignValues.split(" "); alignValues = alignValues.without(""); alignValues.each((function(alignValue) { switch (alignValue) { case 'top': case 'middle': case 'bottom': if(!this._verticalAlign) {this._verticalAlign = alignValue;} break; case 'left': case 'center': case 'right': if(!this._horizontalAlign) {this._horizontalAlign = alignValue;} break; } }).bind(this)); } //set edge position (only in case the label belongs to an edge) this.edgePosition = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'edgePosition'); if(this.edgePosition) { this.edgePosition = this.edgePosition.toLowerCase(); } //get offset top this.offsetTop = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'offsetTop') || ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP; if(this.offsetTop) { this.offsetTop = parseInt(this.offsetTop); } //get offset top this.offsetBottom = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'offsetBottom') || ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM; if(this.offsetBottom) { this.offsetBottom = parseInt(this.offsetBottom); } //set rotation var rotateValue = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'rotate'); if(rotateValue) { try { this._rotate = parseFloat(rotateValue); } catch (e) { this._rotate = 0; } } else { this._rotate = 0; } //anchors var anchorAttr = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors"); if(anchorAttr) { anchorAttr = anchorAttr.replace("/,/g", " "); var anchors = anchorAttr.split(" ").without(""); for(var i = 0; i < anchors.length; i++) { switch(anchors[i].toLowerCase()) { case "left": this.anchorLeft = true; break; case "right": this.anchorRight = true; break; case "top": this.anchorTop = true; break; case "bottom": this.anchorBottom = true; break; } } } //if no alignment defined, set default alignment if(!this._verticalAlign) { this._verticalAlign = 'bottom'; } if(!this._horizontalAlign) { this._horizontalAlign = 'left'; } var xValue = this.node.getAttributeNS(null, 'x'); if(xValue) { this.x = parseFloat(xValue); this.oldX = this.x; } else { //TODO error } var yValue = this.node.getAttributeNS(null, 'y'); if(yValue) { this.y = parseFloat(yValue); this.oldY = this.y; } else { //TODO error } //set initial text /*if (this.node.textContent == "") { this.node.textContent = "fail"; }*/ this.text(this.node.textContent); this.node.addEventListener("mouseover", function changeCursor() { document.body.style.cursor = "text"; }, false); this.node.addEventListener("mouseout", function changeCursor() { document.body.style.cursor = "default"; }, false); if (typeof this.eventHandler === "function") { this.node.addEventListener("dblclick", function() { this.eventHandler({ 'type': ORYX.CONFIG.EVENT_LABEL_DBLCLICK, 'label': this }); }.bind(this), false); } }, changed: function() { this._isChanged = true; }, /** * Update the SVG text element. */ update: function() { if(this._isChanged || this.x !== this.oldX || this.y !== this.oldY) { if (this.isVisible) { this._isChanged = false; this.node.setAttributeNS(null, 'x', this.x); this.node.setAttributeNS(null, 'y', this.y); //this.node.setAttributeNS(null, 'font-size', this._fontSize); //this.node.setAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align', this._horizontalAlign + " " + this._verticalAlign); //set horizontal alignment switch (this._horizontalAlign) { case 'left': this.node.setAttributeNS(null, 'text-anchor', 'start'); break; case 'center': this.node.setAttributeNS(null, 'text-anchor', 'middle'); break; case 'right': this.node.setAttributeNS(null, 'text-anchor', 'end'); break; } this.oldX = this.x; this.oldY = this.y; //set rotation if (this._rotate !== undefined) { if (this._rotationPoint) this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this._rotationPoint.x + ' ' + this._rotationPoint.y + ')'); else this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this.x + ' ' + this.y + ')'); } var textLines = this._text.split("\n"); while (textLines.last() == "") textLines.pop(); this.node.textContent = ""; if (this.node.ownerDocument) { textLines.each((function(textLine, index){ var tspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan'); tspan.textContent = textLine; tspan.setAttributeNS(null, 'x', this.invisibleRenderPoint); tspan.setAttributeNS(null, 'y', this.invisibleRenderPoint); /* * Chrome's getBBox() method fails, if a text node contains an empty tspan element. * So, we add a whitespace to such a tspan element. */ if(tspan.textContent === "") { tspan.textContent = " "; } //append tspan to text node this.node.appendChild(tspan); }).bind(this)); //Work around for Mozilla bug 293581 if (this.isVisible) { this.node.setAttributeNS(null, 'visibility', 'hidden'); } if (this.fitToElemId) window.setTimeout(this._checkFittingToReferencedElem.bind(this), 0); else window.setTimeout(this._positionText.bind(this), 0); } } else { this.node.textContent = ""; } } }, _checkFittingToReferencedElem: function() { try { var tspans = $A(this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan')); //only do this in firefox 3. all other browsers do not support word wrapping!!!!! //if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1)>=3) { var newtspans = []; var refNode = this.node.ownerDocument.getElementById(this.fitToElemId); if (refNode) { var refbb = refNode.getBBox(); var fontSize = this.getFontSize(); for (var j = 0; j < tspans.length; j++) { var tspan = tspans[j]; var textLength = this._getRenderedTextLength(tspan, undefined, undefined, fontSize); if (textLength > refbb.width) { var startIndex = 0; var lastSeperatorIndex = 0; var numOfChars = this.getTrimmedTextLength(tspan.textContent); for (var i = 0; i < numOfChars; i++) { var sslength = this._getRenderedTextLength(tspan, startIndex, i-startIndex, fontSize); if (sslength > refbb.width - 2) { var newtspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan'); if (lastSeperatorIndex <= startIndex) { lastSeperatorIndex = (i == 0) ? i : i-1; newtspan.textContent = tspan.textContent.slice(startIndex, lastSeperatorIndex); //lastSeperatorIndex = i; } else { newtspan.textContent = tspan.textContent.slice(startIndex, ++lastSeperatorIndex); } newtspan.setAttributeNS(null, 'x', this.invisibleRenderPoint); newtspan.setAttributeNS(null, 'y', this.invisibleRenderPoint); //insert tspan to text node //this.node.insertBefore(newtspan, tspan); newtspans.push(newtspan); startIndex = lastSeperatorIndex; } else { var curChar = tspan.textContent.charAt(i); if (curChar == ' ' || curChar == '-' || curChar == "." || curChar == "," || curChar == ";" || curChar == ":") { lastSeperatorIndex = i; } } } tspan.textContent = tspan.textContent.slice(startIndex); } newtspans.push(tspan); } while (this.node.hasChildNodes()) this.node.removeChild(this.node.childNodes[0]); while (newtspans.length > 0) { this.node.appendChild(newtspans.shift()); } } //} } catch (e) { //console.log(e); } window.setTimeout(this._positionText.bind(this), 0); }, /** * This is a work around method for Mozilla bug 293581. * Before the method getComputedTextLength works, the text has to be rendered. */ _positionText: function() { try { var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan'); var fontSize = this.getFontSize(this.node); var invalidTSpans = []; $A(tspans).each((function(tspan, index){ if(tspan.textContent.trim() === "") { invalidTSpans.push(tspan); } else { //set vertical position var dy = 0; switch (this._verticalAlign) { case 'bottom': dy = -(tspans.length - index - 1) * (fontSize); break; case 'middle': dy = -(tspans.length / 2.0 - index - 1) * (fontSize); dy -= ORYX.CONFIG.LABEL_LINE_DISTANCE / 2; break; case 'top': dy = index * (fontSize); dy += fontSize; break; } tspan.setAttributeNS(null, 'dy', dy); tspan.setAttributeNS(null, 'x', this.x); tspan.setAttributeNS(null, 'y', this.y); } }).bind(this)); invalidTSpans.each(function(tspan) { this.node.removeChild(tspan) }.bind(this)); } catch(e) { //console.log(e); this._isChanged = true; } if(this.isVisible) { this.node.setAttributeNS(null, 'visibility', 'inherit'); } }, /** * Returns the text length of the text content of an SVG tspan element. * For all browsers but Firefox 3 the values are estimated. * @param {TSpanSVGElement} tspan * @param {int} startIndex Optional, for sub strings * @param {int} endIndex Optional, for sub strings */ _getRenderedTextLength: function(tspan, startIndex, endIndex, fontSize) { if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1) >= 3) { if(typeof startIndex === "undefined") { //test string: abcdefghijklmnopqrstuvwxyzöäü,.-#+ 1234567890ßABCDEFGHIJKLMNOPQRSTUVWXYZ;:_'*ÜÄÖ!"§$%&/()=?[]{}|<>'~´`\^°µ@€²³ // for(var i = 0; i < tspan.textContent.length; i++) { // console.log(tspan.textContent.charAt(i), tspan.getSubStringLength(i,1), this._estimateCharacterWidth(tspan.textContent.charAt(i))*(fontSize/14.0)); // } return tspan.getComputedTextLength(); } else { return tspan.getSubStringLength(startIndex, endIndex); } } else { if(typeof startIndex === "undefined") { return this._estimateTextWidth(tspan.textContent, fontSize); } else { return this._estimateTextWidth(tspan.textContent.substr(startIndex, endIndex).trim(), fontSize); } } }, /** * Estimates the text width for a string. * Used for word wrapping in all browser but FF3. * @param {Object} text */ _estimateTextWidth: function(text, fontSize) { var sum = 0.0; for(var i = 0; i < text.length; i++) { sum += this._estimateCharacterWidth(text.charAt(i)); } return sum*(fontSize/14.0); }, /** * Estimates the width of a single character for font size 14. * Used for word wrapping in all browser but FF3. * @param {Object} character */ _estimateCharacterWidth: function(character) { for(var i = 0; i < this._characterSets.length; i++) { if(this._characterSets[i].indexOf(character) >= 0) { return this._characterSetValues[i]; } } return 9; }, getReferencedElementWidth: function() { var refNode = this.node.ownerDocument.getElementById(this.fitToElemId); if (refNode) { var refbb = refNode.getBBox(); if(refbb) { return refbb.width; } else { return undefined; } } else { return undefined; } }, /** * If no parameter is provided, this method returns the current text. * @param text {String} Optional. Replaces the old text with this one. */ text: function() { switch (arguments.length) { case 0: return this._text break; case 1: var oldText = this._text; if(arguments[0]) { this._text = arguments[0].toString(); } else { this._text = ""; } if(oldText !== this._text) { this._isChanged = true; } break; default: //TODO error break; } }, verticalAlign: function() { switch(arguments.length) { case 0: return this._verticalAlign; case 1: if(['top', 'middle', 'bottom'].member(arguments[0])) { var oldValue = this._verticalAlign; this._verticalAlign = arguments[0]; if(this._verticalAlign !== oldValue) { this._isChanged = true; } } break; default: //TODO error break; } }, horizontalAlign: function() { switch(arguments.length) { case 0: return this._horizontalAlign; case 1: if(['left', 'center', 'right'].member(arguments[0])) { var oldValue = this._horizontalAlign; this._horizontalAlign = arguments[0]; if(this._horizontalAlign !== oldValue) { this._isChanged = true; } } break; default: //TODO error break; } }, rotate: function() { switch(arguments.length) { case 0: return this._rotate; case 1: if (this._rotate != arguments[0]) { this._rotate = arguments[0]; this._rotationPoint = undefined; this._isChanged = true; } case 2: if(this._rotate != arguments[0] || !this._rotationPoint || this._rotationPoint.x != arguments[1].x || this._rotationPoint.y != arguments[1].y) { this._rotate = arguments[0]; this._rotationPoint = arguments[1]; this._isChanged = true; } } }, hide: function() { if(this.isVisible) { this.isVisible = false; this._isChanged = true; } }, show: function() { if(!this.isVisible) { this.isVisible = true; this._isChanged = true; } }, /** * iterates parent nodes till it finds a SVG font-size * attribute. * @param {SVGElement} node */ getInheritedFontSize: function(node) { if(!node || !node.getAttributeNS) return; var attr = node.getAttributeNS(null, "font-size"); if(attr) { return parseFloat(attr); } else if(!ORYX.Editor.checkClassType(node, SVGSVGElement)) { return this.getInheritedFontSize(node.parentNode); } }, getFontSize: function(node) { var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan'); //trying to get an inherited font-size attribute //NO CSS CONSIDERED! var fontSize = this.getInheritedFontSize(this.node); if (!fontSize) { //because this only works in firefox 3, all other browser use the default line height if (tspans[0] && /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1) >= 3) { fontSize = tspans[0].getExtentOfChar(0).height; } else { fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT; } //handling of unsupported method in webkit if (fontSize <= 0) { fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT; } } if(fontSize) this.node.setAttribute("oryx:fontSize", fontSize); return fontSize; }, /** * Get trimmed text length for use with * getExtentOfChar and getSubStringLength. * @param {String} text */ getTrimmedTextLength: function(text) { text = text.strip().gsub(' ', ' '); var oldLength; do { oldLength = text.length; text = text.gsub(' ', ' '); } while (oldLength > text.length); return text.length; }, /** * Returns the offset from * edge to the label which is * positioned under the edge * @return {int} */ getOffsetBottom: function(){ return this.offsetBottom; }, /** * Returns the offset from * edge to the label which is * positioned over the edge * @return {int} */ getOffsetTop: function(){ return this.offsetTop; }, toString: function() { return "Label " + this.id } });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/label.js
JavaScript
mit
20,591
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} /** * EditPathHandler * * Edit SVG paths' coordinates according to specified from-to movement and * horizontal and vertical scaling factors. * The resulting path's d attribute is stored in instance variable d. * * @constructor */ ORYX.Core.SVG.EditPathHandler = Clazz.extend({ construct: function() { arguments.callee.$.construct.apply(this, arguments); this.x = 0; this.y = 0; this.oldX = 0; this.oldY = 0; this.deltaWidth = 1; this.deltaHeight = 1; this.d = ""; }, /** * init * * @param {float} x Target point's x-coordinate * @param {float} y Target point's y-coordinate * @param {float} oldX Reference point's x-coordinate * @param {float} oldY Reference point's y-coordinate * @param {float} deltaWidth Horizontal scaling factor * @param {float} deltaHeight Vertical scaling factor */ init: function(x, y, oldX, oldY, deltaWidth, deltaHeight) { this.x = x; this.y = y; this.oldX = oldX; this.oldY = oldY; this.deltaWidth = deltaWidth; this.deltaHeight = deltaHeight; this.d = ""; }, /** * editPointsAbs * * @param {Array} points Array of absolutePoints */ editPointsAbs: function(points) { if(points instanceof Array) { var newPoints = []; var x, y; for(var i = 0; i < points.length; i++) { x = (parseFloat(points[i]) - this.oldX)*this.deltaWidth + this.x; i++; y = (parseFloat(points[i]) - this.oldY)*this.deltaHeight + this.y; newPoints.push(x); newPoints.push(y); } return newPoints; } else { //TODO error } }, /** * editPointsRel * * @param {Array} points Array of absolutePoints */ editPointsRel: function(points) { if(points instanceof Array) { var newPoints = []; var x, y; for(var i = 0; i < points.length; i++) { x = parseFloat(points[i])*this.deltaWidth; i++; y = parseFloat(points[i])*this.deltaHeight; newPoints.push(x); newPoints.push(y); } return newPoints; } else { //TODO error } }, /** * arcAbs - A * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { var pointsAbs = this.editPointsAbs([x, y]); var pointsRel = this.editPointsRel([rx, ry]); this.d = this.d.concat(" A" + pointsRel[0] + " " + pointsRel[1] + " " + xAxisRotation + " " + largeArcFlag + " " + sweepFlag + " " + pointsAbs[0] + " " + pointsAbs[1] + " "); }, /** * arcRel - a * * @param {Number} rx * @param {Number} ry * @param {Number} xAxisRotation * @param {Boolean} largeArcFlag * @param {Boolean} sweepFlag * @param {Number} x * @param {Number} y */ arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { var pointsRel = this.editPointsRel([rx, ry, x, y]); this.d = this.d.concat(" a" + pointsRel[0] + " " + pointsRel[1] + " " + xAxisRotation + " " + largeArcFlag + " " + sweepFlag + " " + pointsRel[2] + " " + pointsRel[3] + " "); }, /** * curvetoCubicAbs - C * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicAbs: function(x1, y1, x2, y2, x, y) { var pointsAbs = this.editPointsAbs([x1, y1, x2, y2, x, y]); this.d = this.d.concat(" C" + pointsAbs[0] + " " + pointsAbs[1] + " " + pointsAbs[2] + " " + pointsAbs[3] + " " + pointsAbs[4] + " " + pointsAbs[5] + " "); }, /** * curvetoCubicRel - c * * @param {Number} x1 * @param {Number} y1 * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicRel: function(x1, y1, x2, y2, x, y) { var pointsRel = this.editPointsRel([x1, y1, x2, y2, x, y]); this.d = this.d.concat(" c" + pointsRel[0] + " " + pointsRel[1] + " " + pointsRel[2] + " " + pointsRel[3] + " " + pointsRel[4] + " " + pointsRel[5] + " "); }, /** * linetoHorizontalAbs - H * * @param {Number} x */ linetoHorizontalAbs: function(x) { var pointsAbs = this.editPointsAbs([x, 0]); this.d = this.d.concat(" H" + pointsAbs[0] + " "); }, /** * linetoHorizontalRel - h * * @param {Number} x */ linetoHorizontalRel: function(x) { var pointsRel = this.editPointsRel([x, 0]); this.d = this.d.concat(" h" + pointsRel[0] + " "); }, /** * linetoAbs - L * * @param {Number} x * @param {Number} y */ linetoAbs: function(x, y) { var pointsAbs = this.editPointsAbs([x, y]); this.d = this.d.concat(" L" + pointsAbs[0] + " " + pointsAbs[1] + " "); }, /** * linetoRel - l * * @param {Number} x * @param {Number} y */ linetoRel: function(x, y) { var pointsRel = this.editPointsRel([x, y]); this.d = this.d.concat(" l" + pointsRel[0] + " " + pointsRel[1] + " "); }, /** * movetoAbs - M * * @param {Number} x * @param {Number} y */ movetoAbs: function(x, y) { var pointsAbs = this.editPointsAbs([x, y]); this.d = this.d.concat(" M" + pointsAbs[0] + " " + pointsAbs[1] + " "); }, /** * movetoRel - m * * @param {Number} x * @param {Number} y */ movetoRel: function(x, y) { var pointsRel; if(this.d === "") { pointsRel = this.editPointsAbs([x, y]); } else { pointsRel = this.editPointsRel([x, y]); } this.d = this.d.concat(" m" + pointsRel[0] + " " + pointsRel[1] + " "); }, /** * curvetoQuadraticAbs - Q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticAbs: function(x1, y1, x, y) { var pointsAbs = this.editPointsAbs([x1, y1, x, y]); this.d = this.d.concat(" Q" + pointsAbs[0] + " " + pointsAbs[1] + " " + pointsAbs[2] + " " + pointsAbs[3] + " "); }, /** * curvetoQuadraticRel - q * * @param {Number} x1 * @param {Number} y1 * @param {Number} x * @param {Number} y */ curvetoQuadraticRel: function(x1, y1, x, y) { var pointsRel = this.editPointsRel([x1, y1, x, y]); this.d = this.d.concat(" q" + pointsRel[0] + " " + pointsRel[1] + " " + pointsRel[2] + " " + pointsRel[3] + " "); }, /** * curvetoCubicSmoothAbs - S * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothAbs: function(x2, y2, x, y) { var pointsAbs = this.editPointsAbs([x2, y2, x, y]); this.d = this.d.concat(" S" + pointsAbs[0] + " " + pointsAbs[1] + " " + pointsAbs[2] + " " + pointsAbs[3] + " "); }, /** * curvetoCubicSmoothRel - s * * @param {Number} x2 * @param {Number} y2 * @param {Number} x * @param {Number} y */ curvetoCubicSmoothRel: function(x2, y2, x, y) { var pointsRel = this.editPointsRel([x2, y2, x, y]); this.d = this.d.concat(" s" + pointsRel[0] + " " + pointsRel[1] + " " + pointsRel[2] + " " + pointsRel[3] + " "); }, /** * curvetoQuadraticSmoothAbs - T * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothAbs: function(x, y) { var pointsAbs = this.editPointsAbs([x, y]); this.d = this.d.concat(" T" + pointsAbs[0] + " " + pointsAbs[1] + " "); }, /** * curvetoQuadraticSmoothRel - t * * @param {Number} x * @param {Number} y */ curvetoQuadraticSmoothRel: function(x, y) { var pointsRel = this.editPointsRel([x, y]); this.d = this.d.concat(" t" + pointsRel[0] + " " + pointsRel[1] + " "); }, /** * linetoVerticalAbs - V * * @param {Number} y */ linetoVerticalAbs: function(y) { var pointsAbs = this.editPointsAbs([0, y]); this.d = this.d.concat(" V" + pointsAbs[1] + " "); }, /** * linetoVerticalRel - v * * @param {Number} y */ linetoVerticalRel: function(y) { var pointsRel = this.editPointsRel([0, y]); this.d = this.d.concat(" v" + pointsRel[1] + " "); }, /** * closePath - z or Z */ closePath: function() { this.d = this.d.concat(" z"); } });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/editpathhandler.js
JavaScript
mit
10,086
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * * Config variables */ NAMESPACE_ORYX = "http://www.b3mn.org/oryx"; NAMESPACE_SVG = "http://www.w3.org/2000/svg/"; /** * @classDescription This class wraps the manipulation of a SVG marker. * @namespace ORYX.Core.SVG * uses Inheritance (Clazz) * uses Prototype 1.5.0 * */ /** * Init package */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} ORYX.Core.SVG.SVGMarker = Clazz.extend({ /** * Constructor * @param markerElement {SVGMarkerElement} */ construct: function(markerElement) { arguments.callee.$.construct.apply(this, arguments); this.id = undefined; this.element = markerElement; this.refX = undefined; this.refY = undefined; this.markerWidth = undefined; this.markerHeight = undefined; this.oldRefX = undefined; this.oldRefY = undefined; this.oldMarkerWidth = undefined; this.oldMarkerHeight = undefined; this.optional = false; this.enabled = true; this.minimumLength = undefined; this.resize = false; this.svgShapes = []; this._init(); //initialisation of all the properties declared above. }, /** * Initializes the values that are defined in the constructor. */ _init: function() { //check if this.element is a SVGMarkerElement if(!( this.element == "[object SVGMarkerElement]")) { throw "SVGMarker: Argument is not an instance of SVGMarkerElement."; } this.id = this.element.getAttributeNS(null, "id"); //init svg marker attributes var refXValue = this.element.getAttributeNS(null, "refX"); if(refXValue) { this.refX = parseFloat(refXValue); } else { this.refX = 0; } var refYValue = this.element.getAttributeNS(null, "refY"); if(refYValue) { this.refY = parseFloat(refYValue); } else { this.refY = 0; } var markerWidthValue = this.element.getAttributeNS(null, "markerWidth"); if(markerWidthValue) { this.markerWidth = parseFloat(markerWidthValue); } else { this.markerWidth = 3; } var markerHeightValue = this.element.getAttributeNS(null, "markerHeight"); if(markerHeightValue) { this.markerHeight = parseFloat(markerHeightValue); } else { this.markerHeight = 3; } this.oldRefX = this.refX; this.oldRefY = this.refY; this.oldMarkerWidth = this.markerWidth; this.oldMarkerHeight = this.markerHeight; //init oryx attributes var optionalAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "optional"); if(optionalAttr) { optionalAttr = optionalAttr.strip(); this.optional = (optionalAttr.toLowerCase() === "yes"); } else { this.optional = false; } var enabledAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "enabled"); if(enabledAttr) { enabledAttr = enabledAttr.strip(); this.enabled = !(enabledAttr.toLowerCase() === "no"); } else { this.enabled = true; } var minLengthAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "minimumLength"); if(minLengthAttr) { this.minimumLength = parseFloat(minLengthAttr); } var resizeAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resize"); if(resizeAttr) { resizeAttr = resizeAttr.strip(); this.resize = (resizeAttr.toLowerCase() === "yes"); } else { this.resize = false; } //init SVGShape objects //this.svgShapes = this._getSVGShapes(this.element); }, /** * */ _getSVGShapes: function(svgElement) { if(svgElement.hasChildNodes) { var svgShapes = []; var me = this; $A(svgElement.childNodes).each(function(svgChild) { try { var svgShape = new ORYX.Core.SVG.SVGShape(svgChild); svgShapes.push(svgShape); } catch (e) { svgShapes = svgShapes.concat(me._getSVGShapes(svgChild)); } }); return svgShapes; } }, /** * Writes the changed values into the SVG marker. */ update: function() { //TODO mache marker resizebar!!! aber erst wenn der rest der connectingshape funzt! // //update marker attributes // if(this.refX != this.oldRefX) { // this.element.setAttributeNS(null, "refX", this.refX); // } // if(this.refY != this.oldRefY) { // this.element.setAttributeNS(null, "refY", this.refY); // } // if(this.markerWidth != this.oldMarkerWidth) { // this.element.setAttributeNS(null, "markerWidth", this.markerWidth); // } // if(this.markerHeight != this.oldMarkerHeight) { // this.element.setAttributeNS(null, "markerHeight", this.markerHeight); // } // // //update SVGShape objects // var widthDelta = this.markerWidth / this.oldMarkerWidth; // var heightDelta = this.markerHeight / this.oldMarkerHeight; // if(widthDelta != 1 && heightDelta != 1) { // this.svgShapes.each(function(svgShape) { // // }); // } //update old values to prepare the next update this.oldRefX = this.refX; this.oldRefY = this.refY; this.oldMarkerWidth = this.markerWidth; this.oldMarkerHeight = this.markerHeight; }, toString: function() { return (this.element) ? "SVGMarker " + this.element.id : "SVGMarker " + this.element;} });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/svgmarker.js
JavaScript
mit
6,589
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * * Config variables */ NAMESPACE_ORYX = "http://www.b3mn.org/oryx"; NAMESPACE_SVG = "http://www.w3.org/2000/svg/"; /** * @classDescription This class wraps the manipulation of a SVG basic shape or a path. * @namespace ORYX.Core.SVG * uses Inheritance (Clazz) * uses Prototype 1.5.0 * uses PathParser by Kevin Lindsey (http://kevlindev.com/) * uses MinMaxPathHandler * uses EditPathHandler * */ //init package if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};} ORYX.Core.SVG.SVGShape = Clazz.extend({ /** * Constructor * @param svgElem {SVGElement} An SVGElement that is a basic shape or a path. */ construct: function(svgElem) { arguments.callee.$.construct.apply(this, arguments); this.type; this.element = svgElem; this.x = undefined; this.y = undefined; this.width = undefined; this.height = undefined; this.oldX = undefined; this.oldY = undefined; this.oldWidth = undefined; this.oldHeight = undefined; this.radiusX = undefined; this.radiusY = undefined; this.isHorizontallyResizable = false; this.isVerticallyResizable = false; //this.anchors = []; this.anchorLeft = false; this.anchorRight = false; this.anchorTop = false; this.anchorBottom = false; //attributes of path elements of edge objects this.allowDockers = true; this.resizeMarkerMid = false; this.editPathParser; this.editPathHandler; this.init(); //initialisation of all the properties declared above. }, /** * Initializes the values that are defined in the constructor. */ init: function() { /**initialize position and size*/ if(ORYX.Editor.checkClassType(this.element, SVGRectElement) || ORYX.Editor.checkClassType(this.element, SVGImageElement)) { this.type = "Rect"; var xAttr = this.element.getAttributeNS(null, "x"); if(xAttr) { this.oldX = parseFloat(xAttr); } else { throw "Missing attribute in element " + this.element; } var yAttr = this.element.getAttributeNS(null, "y"); if(yAttr) { this.oldY = parseFloat(yAttr); } else { throw "Missing attribute in element " + this.element; } var widthAttr = this.element.getAttributeNS(null, "width"); if(widthAttr) { this.oldWidth = parseFloat(widthAttr); } else { throw "Missing attribute in element " + this.element; } var heightAttr = this.element.getAttributeNS(null, "height"); if(heightAttr) { this.oldHeight = parseFloat(heightAttr); } else { throw "Missing attribute in element " + this.element; } } else if(ORYX.Editor.checkClassType(this.element, SVGCircleElement)) { this.type = "Circle"; var cx = undefined; var cy = undefined; //var r = undefined; var cxAttr = this.element.getAttributeNS(null, "cx"); if(cxAttr) { cx = parseFloat(cxAttr); } else { throw "Missing attribute in element " + this.element; } var cyAttr = this.element.getAttributeNS(null, "cy"); if(cyAttr) { cy = parseFloat(cyAttr); } else { throw "Missing attribute in element " + this.element; } var rAttr = this.element.getAttributeNS(null, "r"); if(rAttr) { //r = parseFloat(rAttr); this.radiusX = parseFloat(rAttr); } else { throw "Missing attribute in element " + this.element; } this.oldX = cx - this.radiusX; this.oldY = cy - this.radiusX; this.oldWidth = 2*this.radiusX; this.oldHeight = 2*this.radiusX; } else if(ORYX.Editor.checkClassType(this.element, SVGEllipseElement)) { this.type = "Ellipse"; var cx = undefined; var cy = undefined; //var rx = undefined; //var ry = undefined; var cxAttr = this.element.getAttributeNS(null, "cx"); if(cxAttr) { cx = parseFloat(cxAttr); } else { throw "Missing attribute in element " + this.element; } var cyAttr = this.element.getAttributeNS(null, "cy"); if(cyAttr) { cy = parseFloat(cyAttr); } else { throw "Missing attribute in element " + this.element; } var rxAttr = this.element.getAttributeNS(null, "rx"); if(rxAttr) { this.radiusX = parseFloat(rxAttr); } else { throw "Missing attribute in element " + this.element; } var ryAttr = this.element.getAttributeNS(null, "ry"); if(ryAttr) { this.radiusY = parseFloat(ryAttr); } else { throw "Missing attribute in element " + this.element; } this.oldX = cx - this.radiusX; this.oldY = cy - this.radiusY; this.oldWidth = 2*this.radiusX; this.oldHeight = 2*this.radiusY; } else if(ORYX.Editor.checkClassType(this.element, SVGLineElement)) { this.type = "Line"; var x1 = undefined; var y1 = undefined; var x2 = undefined; var y2 = undefined; var x1Attr = this.element.getAttributeNS(null, "x1"); if(x1Attr) { x1 = parseFloat(x1Attr); } else { throw "Missing attribute in element " + this.element; } var y1Attr = this.element.getAttributeNS(null, "y1"); if(y1Attr) { y1 = parseFloat(y1Attr); } else { throw "Missing attribute in element " + this.element; } var x2Attr = this.element.getAttributeNS(null, "x2"); if(x2Attr) { x2 = parseFloat(x2Attr); } else { throw "Missing attribute in element " + this.element; } var y2Attr = this.element.getAttributeNS(null, "y2"); if(y2Attr) { y2 = parseFloat(y2Attr); } else { throw "Missing attribute in element " + this.element; } this.oldX = Math.min(x1,x2); this.oldY = Math.min(y1,y2); this.oldWidth = Math.abs(x1-x2); this.oldHeight = Math.abs(y1-y2); } else if(ORYX.Editor.checkClassType(this.element, SVGPolylineElement) || ORYX.Editor.checkClassType(this.element, SVGPolygonElement)) { this.type = "Polyline"; var points = this.element.getAttributeNS(null, "points"); if(points) { points = points.replace(/,/g , " "); var pointsArray = points.split(" "); pointsArray = pointsArray.without(""); if(pointsArray && pointsArray.length && pointsArray.length > 1) { var minX = parseFloat(pointsArray[0]); var minY = parseFloat(pointsArray[1]); var maxX = parseFloat(pointsArray[0]); var maxY = parseFloat(pointsArray[1]); for(var i = 0; i < pointsArray.length; i++) { minX = Math.min(minX, parseFloat(pointsArray[i])); maxX = Math.max(maxX, parseFloat(pointsArray[i])); i++; minY = Math.min(minY, parseFloat(pointsArray[i])); maxY = Math.max(maxY, parseFloat(pointsArray[i])); } this.oldX = minX; this.oldY = minY; this.oldWidth = maxX-minX; this.oldHeight = maxY-minY; } else { throw "Missing attribute in element " + this.element; } } else { throw "Missing attribute in element " + this.element; } } else if(ORYX.Editor.checkClassType(this.element, SVGPathElement)) { this.type = "Path"; this.editPathParser = new PathParser(); this.editPathHandler = new ORYX.Core.SVG.EditPathHandler(); this.editPathParser.setHandler(this.editPathHandler); var parser = new PathParser(); var handler = new ORYX.Core.SVG.MinMaxPathHandler(); parser.setHandler(handler); parser.parsePath(this.element); this.oldX = handler.minX; this.oldY = handler.minY; this.oldWidth = handler.maxX - handler.minX; this.oldHeight = handler.maxY - handler.minY; delete parser; delete handler; } else { throw "Element is not a shape."; } /** initialize attributes of oryx namespace */ //resize var resizeAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resize"); if(resizeAttr) { resizeAttr = resizeAttr.toLowerCase(); if(resizeAttr.match(/horizontal/)) { this.isHorizontallyResizable = true; } else { this.isHorizontallyResizable = false; } if(resizeAttr.match(/vertical/)) { this.isVerticallyResizable = true; } else { this.isVerticallyResizable = false; } } else { this.isHorizontallyResizable = false; this.isVerticallyResizable = false; } //anchors var anchorAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "anchors"); if(anchorAttr) { anchorAttr = anchorAttr.replace("/,/g", " "); var anchors = anchorAttr.split(" ").without(""); for(var i = 0; i < anchors.length; i++) { switch(anchors[i].toLowerCase()) { case "left": this.anchorLeft = true; break; case "right": this.anchorRight = true; break; case "top": this.anchorTop = true; break; case "bottom": this.anchorBottom = true; break; } } } //allowDockers and resizeMarkerMid if(ORYX.Editor.checkClassType(this.element, SVGPathElement)) { var allowDockersAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "allowDockers"); if(allowDockersAttr) { if(allowDockersAttr.toLowerCase() === "no") { this.allowDockers = false; } else { this.allowDockers = true; } } var resizeMarkerMidAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resizeMarker-mid"); if(resizeMarkerMidAttr) { if(resizeMarkerMidAttr.toLowerCase() === "yes") { this.resizeMarkerMid = true; } else { this.resizeMarkerMid = false; } } } this.x = this.oldX; this.y = this.oldY; this.width = this.oldWidth; this.height = this.oldHeight; }, /** * Writes the changed values into the SVG element. */ update: function() { if(this.x !== this.oldX || this.y !== this.oldY || this.width !== this.oldWidth || this.height !== this.oldHeight) { switch(this.type) { case "Rect": if(this.x !== this.oldX) this.element.setAttributeNS(null, "x", this.x); if(this.y !== this.oldY) this.element.setAttributeNS(null, "y", this.y); if(this.width !== this.oldWidth) this.element.setAttributeNS(null, "width", this.width); if(this.height !== this.oldHeight) this.element.setAttributeNS(null, "height", this.height); break; case "Circle": //calculate the radius //var r; // if(this.width/this.oldWidth <= this.height/this.oldHeight) { // this.radiusX = ((this.width > this.height) ? this.width : this.height)/2.0; // } else { this.radiusX = ((this.width < this.height) ? this.width : this.height)/2.0; //} this.element.setAttributeNS(null, "cx", this.x + this.width/2.0); this.element.setAttributeNS(null, "cy", this.y + this.height/2.0); this.element.setAttributeNS(null, "r", this.radiusX); break; case "Ellipse": this.radiusX = this.width/2; this.radiusY = this.height/2; this.element.setAttributeNS(null, "cx", this.x + this.radiusX); this.element.setAttributeNS(null, "cy", this.y + this.radiusY); this.element.setAttributeNS(null, "rx", this.radiusX); this.element.setAttributeNS(null, "ry", this.radiusY); break; case "Line": if(this.x !== this.oldX) this.element.setAttributeNS(null, "x1", this.x); if(this.y !== this.oldY) this.element.setAttributeNS(null, "y1", this.y); if(this.x !== this.oldX || this.width !== this.oldWidth) this.element.setAttributeNS(null, "x2", this.x + this.width); if(this.y !== this.oldY || this.height !== this.oldHeight) this.element.setAttributeNS(null, "y2", this.y + this.height); break; case "Polyline": var points = this.element.getAttributeNS(null, "points"); if(points) { points = points.replace(/,/g, " ").split(" ").without(""); if(points && points.length && points.length > 1) { //TODO what if oldWidth == 0? var widthDelta = (this.oldWidth === 0) ? 0 : this.width / this.oldWidth; var heightDelta = (this.oldHeight === 0) ? 0 : this.height / this.oldHeight; var updatedPoints = ""; for(var i = 0; i < points.length; i++) { var x = (parseFloat(points[i])-this.oldX)*widthDelta + this.x; i++; var y = (parseFloat(points[i])-this.oldY)*heightDelta + this.y; updatedPoints += x + " " + y + " "; } this.element.setAttributeNS(null, "points", updatedPoints); } else { //TODO error } } else { //TODO error } break; case "Path": //calculate scaling delta //TODO what if oldWidth == 0? var widthDelta = (this.oldWidth === 0) ? 0 : this.width / this.oldWidth; var heightDelta = (this.oldHeight === 0) ? 0 : this.height / this.oldHeight; //use path parser to edit each point of the path this.editPathHandler.init(this.x, this.y, this.oldX, this.oldY, widthDelta, heightDelta); this.editPathParser.parsePath(this.element); //change d attribute of path this.element.setAttributeNS(null, "d", this.editPathHandler.d); break; } this.oldX = this.x; this.oldY = this.y; this.oldWidth = this.width; this.oldHeight = this.height; } }, isPointIncluded: function(pointX, pointY) { // Check if there are the right arguments and if the node is visible if(!pointX || !pointY || !this.isVisible()) { return false; } switch(this.type) { case "Rect": return (pointX >= this.x && pointX <= this.x + this.width && pointY >= this.y && pointY <= this.y+this.height); break; case "Circle": //calculate the radius // var r; // if(this.width/this.oldWidth <= this.height/this.oldHeight) { // r = ((this.width > this.height) ? this.width : this.height)/2.0; // } else { // r = ((this.width < this.height) ? this.width : this.height)/2.0; // } return ORYX.Core.Math.isPointInEllipse(pointX, pointY, this.x + this.width/2.0, this.y + this.height/2.0, this.radiusX, this.radiusX); break; case "Ellipse": return ORYX.Core.Math.isPointInEllipse(pointX, pointY, this.x + this.radiusX, this.y + this.radiusY, this.radiusX, this.radiusY); break; case "Line": return ORYX.Core.Math.isPointInLine(pointX, pointY, this.x, this.y, this.x + this.width, this.y + this.height); break; case "Polyline": var points = this.element.getAttributeNS(null, "points"); if(points) { points = points.replace(/,/g , " ").split(" ").without(""); points = points.collect(function(n) { return parseFloat(n); }); return ORYX.Core.Math.isPointInPolygone(pointX, pointY, points); } else { return false; } break; case "Path": var parser = new PathParser(); var handler = new ORYX.Core.SVG.PointsPathHandler(); parser.setHandler(handler); parser.parsePath(this.element); return ORYX.Core.Math.isPointInPolygone(pointX, pointY, handler.points); break; default: return false; } }, /** * Returns true if the element is visible * @param {SVGElement} elem * @return boolean */ isVisible: function(elem) { if (!elem) { elem = this.element; } var hasOwnerSVG = false; try { hasOwnerSVG = !!elem.ownerSVGElement; } catch(e){} if ( hasOwnerSVG ) { if (ORYX.Editor.checkClassType(elem, SVGGElement)) { if (elem.className && elem.className.baseVal == "me") return true; } var fill = elem.getAttributeNS(null, "fill"); var stroke = elem.getAttributeNS(null, "stroke"); if (fill && fill == "none" && stroke && stroke == "none") { return false; } var attr = elem.getAttributeNS(null, "display"); if(!attr) return this.isVisible(elem.parentNode); else if (attr == "none") return false; else { return true; } } return true; }, toString: function() { return (this.element) ? "SVGShape " + this.element.id : "SVGShape " + this.element;} });
08to09-processwave
oryx/editor/client/scripts/Core/SVG/svgshape.js
JavaScript
mit
17,570
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} /** @namespace Namespace for the Oryx core elements. @name ORYX.Core */ if(!ORYX.Core) {ORYX.Core = {};} /** * @class Oryx canvas. * @extends ORYX.Core.AbstractShape * */ ORYX.Core.Canvas = ORYX.Core.AbstractShape.extend({ /** @lends ORYX.Core.Canvas.prototype */ /** * Defines the current zoom level */ zoomLevel:1, /** * Constructor */ construct: function(options) { arguments.callee.$.construct.apply(this, arguments); if(!(options && options.width && options.height)) { ORYX.Log.fatal("Canvas is missing mandatory parameters options.width and options.height."); return; } //TODO: set document resource id this.resourceId = options.id; this.nodes = []; this.edges = []; //init svg document this.rootNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", options.parentNode, ['svg', {id: this.id, width: options.width, height: options.height}, ['defs', {}] ]); this.defsNode = this.rootNode.getElementsByTagName("defs")[0]; this.rootNode.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); this.rootNode.setAttribute("xmlns:svg", "http://www.w3.org/2000/svg"); this._htmlContainer = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", options.parentNode, ['div', {id: "oryx_canvas_htmlContainer", style:"position:absolute; top:5px"}]); this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg", this.rootNode, ['g', {}, ['g', {"class": "stencils"}, ['g', {"class": "me"}], ['g', {"class": "children"}], ['g', {"class": "edge"}] ], ['g', {"class":"svgcontainer"}] ] ); /* var off = 2 * ORYX.CONFIG.GRID_DISTANCE; var size = 3; var d = ""; for(var i = 0; i <= options.width; i += off) for(var j = 0; j <= options.height; j += off) d = d + "M" + (i - size) + " " + j + " l" + (2*size) + " 0 m" + (-size) + " " + (-size) + " l0 " + (2*size) + " m0" + (-size) + " "; ORYX.Editor.graft("http://www.w3.org/2000/svg", this.node.firstChild.firstChild, ['path', {d:d , stroke:'#000000', 'stroke-width':'0.15px'},]); */ //Global definition of default font for shapes //Definitions in the SVG definition of a stencil will overwrite these settings for // that stencil. /*if(navigator.platform.indexOf("Mac") > -1) { this.node.setAttributeNS(null, 'stroke', 'black'); this.node.setAttributeNS(null, 'stroke-width', '0.5px'); this.node.setAttributeNS(null, 'font-family', 'Skia'); //this.node.setAttributeNS(null, 'letter-spacing', '2px'); this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT); } else { this.node.setAttributeNS(null, 'stroke', 'none'); this.node.setAttributeNS(null, 'font-family', 'Verdana'); this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT); }*/ this.node.setAttributeNS(null, 'stroke', 'black'); this.node.setAttributeNS(null, 'font-family', 'Verdana, sans-serif'); this.node.setAttributeNS(null, 'font-size-adjust', 'none'); this.node.setAttributeNS(null, 'font-style', 'normal'); this.node.setAttributeNS(null, 'font-variant', 'normal'); this.node.setAttributeNS(null, 'font-weight', 'normal'); this.node.setAttributeNS(null, 'line-heigth', 'normal'); this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT); this.bounds.set(0,0,options.width, options.height); this.addEventHandlers(this.rootNode.parentNode); //disable context menu this.rootNode.oncontextmenu = function() {return false;}; }, update: function() { this.nodes.each(function(node) { this._traverseForUpdate(node); }.bind(this)); // call stencil's layout callback // (needed for row layouting of xforms) //this.getStencil().layout(this); var layoutEvents = this.getStencil().layout(); if(layoutEvents) { layoutEvents.each(function(event) { // setup additional attributes event.shape = this; event.forceExecution = true; event.target = this.rootNode; // do layouting this._delegateEvent(event); }.bind(this)) } this.nodes.invoke("_update"); this.edges.invoke("_update", true); /*this.children.each(function(child) { child._update(); });*/ }, _traverseForUpdate: function(shape) { var childRet = shape.isChanged; shape.getChildNodes(false, function(child) { if(this._traverseForUpdate(child)) { childRet = true; } }.bind(this)); if(childRet) { shape.layout(); return true; } else { return false; } }, layout: function() { }, /** * * @param {Object} deep * @param {Object} iterator */ getChildNodes: function(deep, iterator) { if(!deep && !iterator) { return this.nodes.clone(); } else { var result = []; this.nodes.each(function(uiObject) { if(iterator) { iterator(uiObject); } result.push(uiObject); if(deep && uiObject instanceof ORYX.Core.Shape) { result = result.concat(uiObject.getChildNodes(deep, iterator)); } }); return result; } }, /** * buggy crap! use base class impl instead! * @param {Object} iterator */ /* getChildEdges: function(iterator) { if(iterator) { this.edges.each(function(edge) { iterator(edge); }); } return this.edges.clone(); }, */ /** * Overrides the UIObject.add method. Adds uiObject to the correct sub node. * @param {UIObject} uiObject */ add: function(uiObject) { //if uiObject is child of another UIObject, remove it. if(uiObject instanceof ORYX.Core.UIObject) { if (!(this.children.member(uiObject))) { //if uiObject is child of another parent, remove it from that parent. if(uiObject.parent) { uiObject.parent.remove(uiObject); } //add uiObject to the Canvas this.children.push(uiObject); //set parent reference uiObject.parent = this; //add uiObject.node to this.node depending on the type of uiObject if(uiObject instanceof ORYX.Core.Shape) { if(uiObject instanceof ORYX.Core.Edge) { uiObject.addMarkers(this.rootNode.getElementsByTagNameNS(NAMESPACE_SVG, "defs")[0]); uiObject.node = this.node.childNodes[0].childNodes[2].appendChild(uiObject.node); this.edges.push(uiObject); } else { uiObject.node = this.node.childNodes[0].childNodes[1].appendChild(uiObject.node); this.nodes.push(uiObject); } } else { //UIObject uiObject.node = this.node.appendChild(uiObject.node); } uiObject.bounds.registerCallback(this._changedCallback); if(this.eventHandlerCallback) this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject}) } else { ORYX.Log.warn("add: ORYX.Core.UIObject is already a child of this object."); } } else { ORYX.Log.fatal("add: Parameter is not of type ORYX.Core.UIObject."); } }, /** * Overrides the UIObject.remove method. Removes uiObject. * @param {UIObject} uiObject */ remove: function(uiObject) { //if uiObject is a child of this object, remove it. if (this.children.member(uiObject)) { //remove uiObject from children this.children = this.children.without(uiObject); //delete parent reference of uiObject uiObject.parent = undefined; //delete uiObject.node from this.node if(uiObject instanceof ORYX.Core.Shape) { if(uiObject instanceof ORYX.Core.Edge) { uiObject.removeMarkers(); uiObject.node = this.node.childNodes[0].childNodes[2].removeChild(uiObject.node); this.edges = this.edges.without(uiObject); } else { uiObject.node = this.node.childNodes[0].childNodes[1].removeChild(uiObject.node); this.nodes = this.nodes.without(uiObject); } } else { //UIObject uiObject.node = this.node.removeChild(uiObject.node); } uiObject.bounds.unregisterCallback(this._changedCallback); } else { ORYX.Log.warn("remove: ORYX.Core.UIObject is not a child of this object."); } }, /** * Creates shapes out of the given collection of shape objects and adds them to the canvas. * @example * canvas.addShapeObjects({ bounds:{ lowerRight:{ y:510, x:633 }, upperLeft:{ y:146, x:210 } }, resourceId:"oryx_F0715955-50F2-403D-9851-C08CFE70F8BD", childShapes:[], properties:{}, stencil:{ id:"Subprocess" }, outgoing:[{resourceId: 'aShape'}], target: {resourceId: 'aShape'} }); * @param {Object} shapeObjects * @param {Function} [eventHandler] An event handler passed to each newly created shape (as eventHandlerCallback) * @return {Array} A collection of ORYX.Core.Shape * @methodOf ORYX.Core.Canvas.prototype */ addShapeObjects: function(shapeObjects, eventHandler){ if(!shapeObjects) return; /*FIXME This implementation is very evil! At first, all shapes are created on canvas. In a second step, the attributes are applied. There must be a distinction between the configuration phase (where the outgoings, for example, are just named), and the creation phase (where the outgoings are evaluated). This must be reflected in code to provide a nicer API/ implementation!!! */ var addShape = function(shape, parent){ // Try to create a new Shape try { // Create a new Stencil var stencil = ORYX.Core.StencilSet.stencil(this.getStencil().namespace() + shape.stencil.id ); // Create a new Shape var ShapeClass = (stencil.type() == "node") ? ORYX.Core.Node : ORYX.Core.Edge; var newShape = new ShapeClass( {'eventHandlerCallback': eventHandler}, stencil); // Set the resource id newShape.resourceId = shape.resourceId; // Set parent to json object to be used later // Due to the nested json structure, normally shape.parent is not set/ must not be set. // In special cases, it can be easier to set this directly instead of a nested structure. //shape.parent = "#" + ((shape.parent && shape.parent.resourceId) || parent.resourceId); if (typeof shape.parent !== "undefined") { var newParent = this.getChildShapeOrCanvasByResourceId(shape.parent.resourceId); } else if (typeof parent !== "undefined") { var newParent = this.getChildShapeOrCanvasByResourceId(parent.resourceId); } else { var newParent = this; } // Add the shape to the canvas //this.add( newShape ); newShape.parent = newParent; newParent.add(newShape); this.update(); return { json: shape, object: newShape }; } catch(e) { ORYX.Log.warn("LoadingContent: Stencil could not create."); } }.bind(this); /** Builds up recursively a flatted array of shapes, including a javascript object and json representation * @param {Object} shape Any object that has Object#childShapes */ var addChildShapesRecursively = function(shape){ var addedShapes = []; shape.childShapes.each(function(childShape){ /* * workaround for Chrome, for some reason an undefined shape is given */ var xy=addShape(childShape, shape); if(!(typeof xy ==="undefined")){ addedShapes.push(xy); } addedShapes = addedShapes.concat(addChildShapesRecursively(childShape)); }); return addedShapes; }.bind(this); var shapes = addChildShapesRecursively({ childShapes: shapeObjects, resourceId: this.resourceId }); // prepare deserialisation parameter shapes.each( function(shape){ var properties = []; for(field in shape.json.properties){ properties.push({ prefix: 'oryx', name: field, value: shape.json.properties[field] }); } // Outgoings shape.json.outgoing.each(function(out){ properties.push({ prefix: 'raziel', name: 'outgoing', value: "#"+out.resourceId }); }); // Target // (because of a bug, the first outgoing is taken when there is no target, // can be removed after some time) if(shape.object instanceof ORYX.Core.Edge) { var target = shape.json.target || shape.json.outgoing[0]; if(target){ properties.push({ prefix: 'raziel', name: 'target', value: "#"+target.resourceId }); } } // Bounds if (shape.json.bounds) { properties.push({ prefix: 'oryx', name: 'bounds', value: shape.json.bounds.upperLeft.x + "," + shape.json.bounds.upperLeft.y + "," + shape.json.bounds.lowerRight.x + "," + shape.json.bounds.lowerRight.y }); } //Dockers [{x:40, y:50}, {x:30, y:60}] => "40 50 30 60 #" if(shape.json.dockers){ properties.push({ prefix: 'oryx', name: 'dockers', value: shape.json.dockers.inject("", function(dockersStr, docker){ return dockersStr + docker.x + " " + docker.y + " "; }) + " #" }); } //Parent properties.push({ prefix: 'raziel', name: 'parent', value: shape.json.parent }); shape.__properties = properties; }.bind(this) ); // Deserialize the properties from the shapes // This can't be done earlier because Shape#deserialize expects that all referenced nodes are already there // first, deserialize all nodes shapes.each(function(shape) { if(shape.object instanceof ORYX.Core.Node) { shape.object.deserialize(shape.__properties); } }); // second, deserialize all edges shapes.each(function(shape) { if(shape.object instanceof ORYX.Core.Edge) { shape.object.deserialize(shape.__properties); for (var i = 0; i < shape.object.dockers.length; i++) { shape.object.dockers[i].id = shape.json.dockers[i].id; } } }); return shapes.pluck("object"); }, /** * Updates the size of the canvas, regarding to the containg shapes. */ updateSize: function(){ // Check the size for the canvas var maxWidth = 0; var maxHeight = 0; var offset = 100; this.getChildShapes(true, function(shape){ var b = shape.bounds; maxWidth = Math.max( maxWidth, b.lowerRight().x + offset) maxHeight = Math.max( maxHeight, b.lowerRight().y + offset) }); if( this.bounds.width() < maxWidth || this.bounds.height() < maxHeight ){ this.setSize({width: Math.max(this.bounds.width(), maxWidth), height: Math.max(this.bounds.height(), maxHeight)}) } }, getRootNode: function() { return this.rootNode; }, getDefsNode: function() { return this.defsNode; }, getSvgContainer: function() { return this.node.childNodes[1]; }, getHTMLContainer: function() { return this._htmlContainer; }, /** * Return all elements of the same highest level * @param {Object} elements */ getShapesWithSharedParent: function(elements) { // If there is no elements, return [] if(!elements || elements.length < 1) { return [] } // If there is one element, return this element if(elements.length == 1) { return elements} return elements.findAll(function(value){ var parentShape = value.parent; while(parentShape){ if(elements.member(parentShape)) return false; parentShape = parentShape.parent } return true; }); }, setSize: function(size, dontSetBounds) { if(!size || !size.width || !size.height){return} if(this.rootNode.parentNode){ this.rootNode.parentNode.style.width = size.width + 'px'; this.rootNode.parentNode.style.height = size.height + 'px'; } this.rootNode.setAttributeNS(null, 'width', size.width); this.rootNode.setAttributeNS(null, 'height', size.height); //this._htmlContainer.style.top = "-" + (size.height + 4) + 'px'; if( !dontSetBounds ){ this.bounds.set({a:{x:0,y:0},b:{x:size.width/this.zoomLevel,y:size.height/this.zoomLevel}}) } }, /** * Returns an SVG document of the current process. * @param {Boolean} escapeText Use true, if you want to parse it with an XmlParser, * false, if you want to use the SVG document in browser on client side. */ getSVGRepresentation: function(escapeText) { // Get the serialized svg image source var svgClone = this.getRootNode().cloneNode(true); this._removeInvisibleElements(svgClone); var x1, y1, x2, y2; try { var bb = this.getRootNode().childNodes[1].getBBox(); x1 = bb.x; y1 = bb.y; x2 = bb.x + bb.width; y2 = bb.y + bb.height; } catch(e) { this.getChildShapes(true).each(function(shape) { var absBounds = shape.absoluteBounds(); var ul = absBounds.upperLeft(); var lr = absBounds.lowerRight(); if(x1 == undefined) { x1 = ul.x; y1 = ul.y; x2 = lr.x; y2 = lr.y; } else { x1 = Math.min(x1, ul.x); y1 = Math.min(y1, ul.y); x2 = Math.max(x2, lr.x); y2 = Math.max(y2, lr.y); } }); } var margin = 50; var width, height, tx, ty; if(x1 == undefined) { width = 0; height = 0; tx = 0; ty = 0; } else { width = x2 - x1; height = y2 - y1; tx = -x1+margin/2; ty = -y1+margin/2; } // Set the width and height svgClone.setAttributeNS(null, 'width', width + margin); svgClone.setAttributeNS(null, 'height', height + margin); svgClone.childNodes[1].firstChild.setAttributeNS(null, 'transform', 'translate(' + tx + ", " + ty + ')'); //remove scale factor svgClone.childNodes[1].removeAttributeNS(null, 'transform'); try{ var svgCont = svgClone.childNodes[1].childNodes[1]; svgCont.parentNode.removeChild(svgCont); } catch(e) {} if(escapeText) { $A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan')).each(function(elem) { elem.textContent = elem.textContent.escapeHTML(); }); $A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text')).each(function(elem) { if(elem.childNodes.length == 0) elem.textContent = elem.textContent.escapeHTML(); }); } // generating absolute urls for the pdf-exporter $A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'image')).each(function(elem) { var href = elem.getAttributeNS("http://www.w3.org/1999/xlink","href"); if(!href.match("^(http|https)://")) { href = window.location.protocol + "//" + window.location.host + href; elem.setAttributeNS("http://www.w3.org/1999/xlink", "href", href); } }); // escape all links $A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'a')).each(function(elem) { elem.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", (elem.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").escapeHTML()); }); return svgClone; }, /** * Removes all nodes (and its children) that has the * attribute visibility set to "hidden" */ _removeInvisibleElements: function(element) { var index = 0; while(index < element.childNodes.length) { var child = element.childNodes[index]; if(child.getAttributeNS && child.getAttributeNS(null, "visibility") === "hidden") { element.removeChild(child); } else { this._removeInvisibleElements(child); index++; } } }, /** * This method checks all shapes on the canvas and removes all shapes that * contain invalid bounds values or dockers values(NaN) */ /*cleanUp: function(parent) { if (!parent) { parent = this; } parent.getChildShapes().each(function(shape){ var a = shape.bounds.a; var b = shape.bounds.b; if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) { parent.remove(shape); } else { shape.getDockers().any(function(docker) { a = docker.bounds.a; b = docker.bounds.b; if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) { parent.remove(shape); return true; } return false; }); shape.getMagnets().any(function(magnet) { a = magnet.bounds.a; b = magnet.bounds.b; if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) { parent.remove(shape); return true; } return false; }); this.cleanUp(shape); } }.bind(this)); },*/ _delegateEvent: function(event) { if(this.eventHandlerCallback && ( event.target == this.rootNode || event.target == this.rootNode.parentNode )) { this.eventHandlerCallback(event, this); } }, toString: function() { return "Canvas " + this.id }, /** * Calls {@link ORYX.Core.AbstractShape#toJSON} and adds some stencil set information. */ toJSON: function() { var json = arguments.callee.$.toJSON.apply(this, arguments); // if(ORYX.CONFIG.STENCILSET_HANDLER.length > 0) { // json.stencilset = { // url: this.getStencil().stencilSet().namespace() // }; // } else { json.stencilset = { url: this.getStencil().stencilSet().source(), namespace: this.getStencil().stencilSet().namespace() }; // } return json; }, getChildShapeOrCanvasByResourceId: function getChildShapeOrCanvasByResourceId(resourceId) { resourceId = ERDF.__stripHashes(resourceId); if (this.resourceId == resourceId) { return this; } else { return this.getChildShapeByResourceId(resourceId); } } });
08to09-processwave
oryx/editor/client/scripts/Core/canvas.js
JavaScript
mit
25,327
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} ORYX.Core.UIEnableDrag = function(event, uiObj, option) { this.uiObj = uiObj; var upL = uiObj.bounds.upperLeft(); var a = uiObj.node.getScreenCTM(); this.faktorXY= {x: a.a, y: a.d}; this.scrollNode = uiObj.node.ownerSVGElement.parentNode.parentNode; this.offSetPosition = { x: Event.pointerX(event) - (upL.x * this.faktorXY.x), y: Event.pointerY(event) - (upL.y * this.faktorXY.y)}; this.offsetScroll = {x:this.scrollNode.scrollLeft,y:this.scrollNode.scrollTop}; this.dragCallback = ORYX.Core.UIDragCallback.bind(this); this.disableCallback = ORYX.Core.UIDisableDrag.bind(this); this.movedCallback = option ? option.movedCallback : undefined; this.upCallback = option ? option.upCallback : undefined; document.documentElement.addEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this.disableCallback, true); document.documentElement.addEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this.dragCallback , false); }; ORYX.Core.UIDragCallback = function(event) { var position = { x: Event.pointerX(event) - this.offSetPosition.x, y: Event.pointerY(event) - this.offSetPosition.y} position.x -= this.offsetScroll.x - this.scrollNode.scrollLeft; position.y -= this.offsetScroll.y - this.scrollNode.scrollTop; position.x /= this.faktorXY.x; position.y /= this.faktorXY.y; this.uiObj.bounds.moveTo(position); //this.uiObj.update(); if(this.movedCallback) this.movedCallback(event); Event.stop(event); }; ORYX.Core.UIDisableDrag = function(event) { document.documentElement.removeEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this.dragCallback, false); document.documentElement.removeEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this.disableCallback, true); if(this.upCallback) this.upCallback(event); this.upCallback = undefined; this.movedCallback = undefined; Event.stop(event); };
08to09-processwave
oryx/editor/client/scripts/Core/svgDrag.js
JavaScript
mit
3,459
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Init namespaces */ if(!ORYX) {var ORYX = {};} if(!ORYX.Core) {ORYX.Core = {};} /** * @classDescription With Bounds you can set and get position and size of UIObjects. */ ORYX.Core.Bounds = { /** * Constructor */ construct: function() { this._changedCallbacks = []; //register a callback with changedCallacks.push(this.method.bind(this)); this.a = {}; this.b = {}; this.set.apply(this, arguments); this.suspendChange = false; this.changedWhileSuspend = false; }, /** * Calls all registered callbacks. */ _changed: function(sizeChanged) { if(!this.suspendChange) { this._changedCallbacks.each(function(callback) { callback(this, sizeChanged); }.bind(this)); this.changedWhileSuspend = false; } else this.changedWhileSuspend = true; }, /** * Registers a callback that is called, if the bounds changes. * @param callback {Function} The callback function. */ registerCallback: function(callback) { if(!this._changedCallbacks.member(callback)) { this._changedCallbacks.push(callback); } }, /** * Unregisters a callback. * @param callback {Function} The callback function. */ unregisterCallback: function(callback) { this._changedCallbacks = this._changedCallbacks.without(callback); }, resize: function resize(orientation, newBounds) { var changed = false; if (orientation === "southeast") { if (this.width() !== newBounds.width) { changed = true; var difference = newBounds.width - this.width(); this.a.x = this.a.x - difference; } if (this.height() !== newBounds.height) { changed = true; var difference = newBounds.height - this.height(); this.a.y = this.a.y - difference; } } else if (orientation === "northwest") { if (this.width() !== newBounds.width) { changed = true; var difference = newBounds.width - this.width(); this.b.x = this.b.x + difference; } if (this.height !== newBounds.height) { changed = true; var difference = newBounds.height - this.height(); this.b.y = this.b.y + difference; } } if(changed) { this._changed(true); } }, /** * Sets position and size of the shape dependent of four coordinates * (set(ax, ay, bx, by);), two points (set({x: ax, y: ay}, {x: bx, y: by});) * or one bound (set({a: {x: ax, y: ay}, b: {x: bx, y: by}});). */ set: function() { var changed = false; switch (arguments.length) { case 1: if(this.a.x !== arguments[0].a.x) { changed = true; this.a.x = arguments[0].a.x; } if(this.a.y !== arguments[0].a.y) { changed = true; this.a.y = arguments[0].a.y; } if(this.b.x !== arguments[0].b.x) { changed = true; this.b.x = arguments[0].b.x; } if(this.b.y !== arguments[0].b.y) { changed = true; this.b.y = arguments[0].b.y; } break; case 2: var ax = Math.min(arguments[0].x, arguments[1].x); var ay = Math.min(arguments[0].y, arguments[1].y); var bx = Math.max(arguments[0].x, arguments[1].x); var by = Math.max(arguments[0].y, arguments[1].y); if(this.a.x !== ax) { changed = true; this.a.x = ax; } if(this.a.y !== ay) { changed = true; this.a.y = ay; } if(this.b.x !== bx) { changed = true; this.b.x = bx; } if(this.b.y !== by) { changed = true; this.b.y = by; } break; case 4: var ax = Math.min(arguments[0], arguments[2]); var ay = Math.min(arguments[1], arguments[3]); var bx = Math.max(arguments[0], arguments[2]); var by = Math.max(arguments[1], arguments[3]); if(this.a.x !== ax) { changed = true; this.a.x = ax; } if(this.a.y !== ay) { changed = true; this.a.y = ay; } if(this.b.x !== bx) { changed = true; this.b.x = bx; } if(this.b.y !== by) { changed = true; this.b.y = by; } break; } if(changed) { this._changed(true); } }, /** * Moves the bounds so that the point p will be the new upper left corner. * @param {Point} p * or * @param {Number} x * @param {Number} y */ moveTo: function() { var currentPosition = this.upperLeft(); switch (arguments.length) { case 1: this.moveBy({ x: arguments[0].x - currentPosition.x, y: arguments[0].y - currentPosition.y }); break; case 2: this.moveBy({ x: arguments[0] - currentPosition.x, y: arguments[1] - currentPosition.y }); break; default: //TODO error } }, /** * Moves the bounds relatively by p. * @param {Point} p * or * @param {Number} x * @param {Number} y * */ moveBy: function() { var changed = false; switch (arguments.length) { case 1: var p = arguments[0]; if(p.x !== 0 || p.y !== 0) { changed = true; this.a.x += p.x; this.b.x += p.x; this.a.y += p.y; this.b.y += p.y; } break; case 2: var x = arguments[0]; var y = arguments[1]; if(x !== 0 || y !== 0) { changed = true; this.a.x += x; this.b.x += x; this.a.y += y; this.b.y += y; } break; default: //TODO error } if(changed) { this._changed(); } }, /*** * Includes the bounds b into the current bounds. * @param {Bounds} b */ include: function(b) { if( (this.a.x === undefined) && (this.a.y === undefined) && (this.b.x === undefined) && (this.b.y === undefined)) { return b; }; var cx = Math.min(this.a.x,b.a.x); var cy = Math.min(this.a.y,b.a.y); var dx = Math.max(this.b.x,b.b.x); var dy = Math.max(this.b.y,b.b.y); this.set(cx, cy, dx, dy); }, /** * Relatively extends the bounds by p. * @param {Point} p */ extend: function(p) { if(p.x !== 0 || p.y !== 0) { // this is over cross for the case that a and b have same coordinates. //((this.a.x > this.b.x) ? this.a : this.b).x += p.x; //((this.b.y > this.a.y) ? this.b : this.a).y += p.y; this.b.x += p.x; this.b.y += p.y; this._changed(true); } }, /** * Widens the scope of the bounds by x. * @param {Number} x */ widen: function(x) { if (x !== 0) { this.suspendChange = true; this.moveBy({x: -x, y: -x}); this.extend({x: 2*x, y: 2*x}); this.suspendChange = false; if(this.changedWhileSuspend) { this._changed(true); } } }, /** * Returns the upper left corner's point regardless of the * bound delimiter points. */ upperLeft: function() { return {x:this.a.x, y:this.a.y}; }, /** * Returns the lower Right left corner's point regardless of the * bound delimiter points. */ lowerRight: function() { return {x:this.b.x, y:this.b.y}; }, /** * @return {Number} Width of bounds. */ width: function() { return this.b.x - this.a.x; }, /** * @return {Number} Height of bounds. */ height: function() { return this.b.y - this.a.y; }, diagonal: function diagonal() { return Math.sqrt((this.width() * this.width()) - (this.height() * this.height())); }, /** * @return {Point} The center point of this bounds. */ center: function() { return { x: (this.a.x + this.b.x)/2.0, y: (this.a.y + this.b.y)/2.0 }; }, /** * @return {Point} The center point of this bounds relative to upperLeft. */ midPoint: function() { return { x: (this.b.x - this.a.x)/2.0, y: (this.b.y - this.a.y)/2.0 }; }, /** * Moves the center point of this bounds to the new position. * @param p {Point} * or * @param x {Number} * @param y {Number} */ centerMoveTo: function() { var currentPosition = this.center(); switch (arguments.length) { case 1: this.moveBy(arguments[0].x - currentPosition.x, arguments[0].y - currentPosition.y); break; case 2: this.moveBy(arguments[0] - currentPosition.x, arguments[1] - currentPosition.y); break; } }, isIncluded: function(point, offset) { var pointX, pointY, offset; // Get the the two Points switch(arguments.length) { case 1: pointX = arguments[0].x; pointY = arguments[0].y; offset = 0; break; case 2: if(arguments[0].x && arguments[0].y) { pointX = arguments[0].x; pointY = arguments[0].y; offset = Math.abs(arguments[1]); } else { pointX = arguments[0]; pointY = arguments[1]; offset = 0; } break; case 3: pointX = arguments[0]; pointY = arguments[1]; offset = Math.abs(arguments[2]); break; default: throw "isIncluded needs one, two or three arguments"; } var ul = this.upperLeft(); var lr = this.lowerRight(); if(pointX >= ul.x - offset && pointX <= lr.x + offset && pointY >= ul.y - offset && pointY <= lr.y + offset) return true; else return false; }, /** * @return {Bounds} A copy of this bounds. */ clone: function() { //Returns a new bounds object without the callback // references of the original bounds return new ORYX.Core.Bounds(this); }, toString: function() { return "( "+this.a.x+" | "+this.a.y+" )/( "+this.b.x+" | "+this.b.y+" )"; }, serializeForERDF: function() { return this.a.x+","+this.a.y+","+this.b.x+","+this.b.y; } }; ORYX.Core.Bounds = Clazz.extend(ORYX.Core.Bounds);
08to09-processwave
oryx/editor/client/scripts/Core/bounds.js
JavaScript
mit
11,465
all: sed -e 's/\/\*.*\*\///' uml2.2.dev.json > uml2.2.json
08to09-processwave
oryx/editor/data/stencilsets/uml2.2/Makefile
Makefile
mit
60
/** * Copyright (c) 2009-2010 * processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin * Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann) * * based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak, * Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz) * * 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. **/ /** * Contains all strings for the default language (en-us). * Version 1 - 08/29/08 */ if(!ORYX) var ORYX = {}; if(!ORYX.I18N) ORYX.I18N = {}; ORYX.I18N.Language = "en_us"; //Pattern <ISO language code>_<ISO country code> in lower case! if(!ORYX.I18N.Oryx) ORYX.I18N.Oryx = {}; ORYX.I18N.Oryx.title = "Oryx"; ORYX.I18N.Oryx.noBackendDefined = "Caution! \nNo Backend defined.\n The requested model cannot be loaded. Try to load a configuration with a save plugin."; ORYX.I18N.Oryx.pleaseWait = "Please wait while loading..."; ORYX.I18N.Oryx.notLoggedOn = "Not logged on"; ORYX.I18N.Oryx.editorOpenTimeout = "The editor does not seem to be started yet. Please check, whether you have a popup blocker enabled and disable it or allow popups for this site. We will never display any commercials on this site."; if(!ORYX.I18N.AddDocker) ORYX.I18N.AddDocker = {}; ORYX.I18N.AddDocker.group = "Docker"; ORYX.I18N.AddDocker.add = "Add Docker"; ORYX.I18N.AddDocker.addDesc = "Add docker to edge (Alt+Click)"; ORYX.I18N.AddDocker.del = "Delete Docker"; ORYX.I18N.AddDocker.delDesc = "Delete docker (Alt+Click)"; if(!ORYX.I18N.SSExtensionLoader) ORYX.I18N.SSExtensionLoader = {}; ORYX.I18N.SSExtensionLoader.group = "Stencil Set"; ORYX.I18N.SSExtensionLoader.add = "Add Stencil Set Extension"; ORYX.I18N.SSExtensionLoader.addDesc = "Add a stencil set extension"; ORYX.I18N.SSExtensionLoader.loading = "Loading Stencil Set Extension"; ORYX.I18N.SSExtensionLoader.noExt = "There are no extensions available or all available extensions are already loaded."; ORYX.I18N.SSExtensionLoader.failed1 = "Loading stencil set extensions configuration failed. The response is not a valid configuration file."; ORYX.I18N.SSExtensionLoader.failed2 = "Loading stencil set extension configuration file failed. The request returned an error."; ORYX.I18N.SSExtensionLoader.panelTitle = "Stencil Set Extensions"; ORYX.I18N.SSExtensionLoader.panelText = "Select the stencil set extensions you want to load."; if(!ORYX.I18N.AdHocCC) ORYX.I18N.AdHocCC = {}; ORYX.I18N.AdHocCC.group = "Ad Hoc"; ORYX.I18N.AdHocCC.compl = "Edit Completion Condition"; ORYX.I18N.AdHocCC.complDesc = "Edit an Ad Hoc Activity's Completion Condition"; ORYX.I18N.AdHocCC.notOne = "Not exactly one element selected!"; ORYX.I18N.AdHocCC.nodAdHocCC = "Selected element has no ad hoc completion condition!"; ORYX.I18N.AdHocCC.selectTask = "Select a task..."; ORYX.I18N.AdHocCC.selectState = "Select a state..."; ORYX.I18N.AdHocCC.addExp = "Add Expression"; ORYX.I18N.AdHocCC.selectDataField = "Select a data field..."; ORYX.I18N.AdHocCC.enterEqual = "Enter a value that must equal..."; ORYX.I18N.AdHocCC.and = "and"; ORYX.I18N.AdHocCC.or = "or"; ORYX.I18N.AdHocCC.not = "not"; ORYX.I18N.AdHocCC.clearCC = "Clear Completion Condition"; ORYX.I18N.AdHocCC.editCC = "Edit Ad-Hoc Completion Condtions"; ORYX.I18N.AdHocCC.addExecState = "Add Execution State Expression: "; ORYX.I18N.AdHocCC.addDataExp = "Add Data Expression: "; ORYX.I18N.AdHocCC.addLogOp = "Add Logical Operators: "; ORYX.I18N.AdHocCC.curCond = "Current Completion Condition: "; if(!ORYX.I18N.AMLSupport) ORYX.I18N.AMLSupport = {}; ORYX.I18N.AMLSupport.group = "EPC"; ORYX.I18N.AMLSupport.imp = "Import AML file"; ORYX.I18N.AMLSupport.impDesc = "Import an Aris 7 AML file"; ORYX.I18N.AMLSupport.failed = "Importing AML file failed. Please check, if the selected file is a valid AML file. Error message: "; ORYX.I18N.AMLSupport.failed2 = "Importing AML file failed: "; ORYX.I18N.AMLSupport.noRights = "You have no rights to import multiple EPC-Diagrams (Login required)."; ORYX.I18N.AMLSupport.panelText = "Select an AML (.xml) file to import."; ORYX.I18N.AMLSupport.file = "File"; ORYX.I18N.AMLSupport.importBtn = "Import AML-File"; ORYX.I18N.AMLSupport.get = "Get diagrams..."; ORYX.I18N.AMLSupport.close = "Close"; ORYX.I18N.AMLSupport.title = "Title"; ORYX.I18N.AMLSupport.selectDiagrams = "Select the diagram(s) you want to import. <br/> If one model is selected, it will be imported in the current editor, if more than one is selected, those models will directly be stored in the repository."; ORYX.I18N.AMLSupport.impText = "Import"; ORYX.I18N.AMLSupport.impProgress = "Importing..."; ORYX.I18N.AMLSupport.cancel = "Cancel"; ORYX.I18N.AMLSupport.name = "Name"; ORYX.I18N.AMLSupport.allImported = "All imported diagrams."; ORYX.I18N.AMLSupport.ok = "Ok"; if(!ORYX.I18N.Arrangement) ORYX.I18N.Arrangement = {}; ORYX.I18N.Arrangement.groupZ = "Z-Order"; ORYX.I18N.Arrangement.btf = "Bring To Front"; ORYX.I18N.Arrangement.btfDesc = "Bring to Front"; ORYX.I18N.Arrangement.btb = "Bring To Back"; ORYX.I18N.Arrangement.btbDesc = "Bring To Back"; ORYX.I18N.Arrangement.bf = "Bring Forward"; ORYX.I18N.Arrangement.bfDesc = "Bring Forward"; ORYX.I18N.Arrangement.bb = "Bring Backward"; ORYX.I18N.Arrangement.bbDesc = "Bring Backward"; ORYX.I18N.Arrangement.groupA = "Alignment"; ORYX.I18N.Arrangement.ab = "Alignment Bottom"; ORYX.I18N.Arrangement.abDesc = "Bottom"; ORYX.I18N.Arrangement.am = "Alignment Middle"; ORYX.I18N.Arrangement.amDesc = "Middle"; ORYX.I18N.Arrangement.at = "Alignment Top"; ORYX.I18N.Arrangement.atDesc = "Top"; ORYX.I18N.Arrangement.al = "Alignment Left"; ORYX.I18N.Arrangement.alDesc = "Left"; ORYX.I18N.Arrangement.ac = "Alignment Center"; ORYX.I18N.Arrangement.acDesc = "Center"; ORYX.I18N.Arrangement.ar = "Alignment Right"; ORYX.I18N.Arrangement.arDesc = "Right"; ORYX.I18N.Arrangement.as = "Alignment Same Size"; ORYX.I18N.Arrangement.asDesc = "Same Size"; if(!ORYX.I18N.BPELSupport) ORYX.I18N.BPELSupport = {}; ORYX.I18N.BPELSupport.group = "BPEL"; ORYX.I18N.BPELSupport.exp = "Export BPEL"; ORYX.I18N.BPELSupport.expDesc = "Export diagram to BPEL"; ORYX.I18N.BPELSupport.imp = "Import BPEL"; ORYX.I18N.BPELSupport.impDesc = "Import a BPEL file"; ORYX.I18N.BPELSupport.selectFile = "Select a BPEL file to import"; ORYX.I18N.BPELSupport.file = "file"; ORYX.I18N.BPELSupport.impPanel = "Import BPEL file"; ORYX.I18N.BPELSupport.impBtn = "Import"; ORYX.I18N.BPELSupport.content = "content"; ORYX.I18N.BPELSupport.close = "Close"; ORYX.I18N.BPELSupport.error = "Error"; ORYX.I18N.BPELSupport.progressImp = "Import..."; ORYX.I18N.BPELSupport.progressExp = "Export..."; ORYX.I18N.BPELSupport.impFailed = "An error while importing occurs! <br/>Please check error message: <br/><br/>"; if(!ORYX.I18N.BPELLayout) ORYX.I18N.BPELLayout = {}; ORYX.I18N.BPELLayout.group = "BPELLayout"; ORYX.I18N.BPELLayout.disable = "disable layout"; ORYX.I18N.BPELLayout.disDesc = "disable auto layout plug-in"; ORYX.I18N.BPELLayout.enable = "enable layout"; ORYX.I18N.BPELLayout.enDesc = "enable auto layout plug-in"; if(!ORYX.I18N.BPEL4ChorSupport) ORYX.I18N.BPEL4ChorSupport = {}; ORYX.I18N.BPEL4ChorSupport.group = "BPEL4Chor"; ORYX.I18N.BPEL4ChorSupport.exp = "Export BPEL4Chor"; ORYX.I18N.BPEL4ChorSupport.expDesc = "Export diagram to BPEL4Chor"; ORYX.I18N.BPEL4ChorSupport.imp = "Import BPEL4Chor"; ORYX.I18N.BPEL4ChorSupport.impDesc = "Import a BPEL4Chor file"; ORYX.I18N.BPEL4ChorSupport.gen = "BPEL4Chor generator"; ORYX.I18N.BPEL4ChorSupport.genDesc = "generate values of some BPEL4Chor properties if they are already known(e.g. sender of messageLink)"; ORYX.I18N.BPEL4ChorSupport.selectFile = "Select a BPEL4Chor file to import"; ORYX.I18N.BPEL4ChorSupport.file = "file"; ORYX.I18N.BPEL4ChorSupport.impPanel = "Import BPEL4Chor file"; ORYX.I18N.BPEL4ChorSupport.impBtn = "Import"; ORYX.I18N.BPEL4ChorSupport.content = "content"; ORYX.I18N.BPEL4ChorSupport.close = "Close"; ORYX.I18N.BPEL4ChorSupport.error = "Error"; ORYX.I18N.BPEL4ChorSupport.progressImp = "Import..."; ORYX.I18N.BPEL4ChorSupport.progressExp = "Export..."; ORYX.I18N.BPEL4ChorSupport.impFailed = "An error while importing occurs! <br/>Please check error message: <br/><br/>"; if(!ORYX.I18N.Bpel4ChorTransformation) ORYX.I18N.Bpel4ChorTransformation = {}; ORYX.I18N.Bpel4ChorTransformation.group = "Export"; ORYX.I18N.Bpel4ChorTransformation.exportBPEL = "Export BPEL4Chor"; ORYX.I18N.Bpel4ChorTransformation.exportBPELDesc = "Export diagram to BPEL4Chor"; ORYX.I18N.Bpel4ChorTransformation.exportXPDL = "Export XPDL4Chor"; ORYX.I18N.Bpel4ChorTransformation.exportXPDLDesc = "Export diagram to XPDL4Chor"; ORYX.I18N.Bpel4ChorTransformation.warning = "Warning"; ORYX.I18N.Bpel4ChorTransformation.wrongValue = 'The changed name must have the value "1" to avoid errors during the transformation to BPEL4Chor'; ORYX.I18N.Bpel4ChorTransformation.loopNone = 'The loop type of the receive task must be "None" to be transformable to BPEL4Chor'; ORYX.I18N.Bpel4ChorTransformation.error = "Error"; ORYX.I18N.Bpel4ChorTransformation.noSource = "1 with id 2 has no source object."; ORYX.I18N.Bpel4ChorTransformation.noTarget = "1 with id 2 has no target object."; ORYX.I18N.Bpel4ChorTransformation.transCall = "An error occured during the transformation call. 1:2"; ORYX.I18N.Bpel4ChorTransformation.loadingXPDL4ChorExport = "Export to XPDL4Chor"; ORYX.I18N.Bpel4ChorTransformation.loadingBPEL4ChorExport = "Export to BPEL4Chor"; ORYX.I18N.Bpel4ChorTransformation.noGen = "The transformation input could not be generated: 1\n2\n"; ORYX.I18N.BPMN2PNConverter = { name: "Convert to Petri net", desc: "Converts BPMN diagrams to Petri nets", group: "Export", error: "Error", errors: { server: "Couldn't import BPNM diagram.", noRights: "Don't you have read permissions on given model?", notSaved: "Model must be saved and reopened for using Petri net exporter!" }, progress: { status: "Status", importingModel: "Importing BPMN Model", fetchingModel: "Fetching", convertingModel: "Converting", renderingModel: "Rendering" } } if(!ORYX.I18N.TransformationDownloadDialog) ORYX.I18N.TransformationDownloadDialog = {}; ORYX.I18N.TransformationDownloadDialog.error = "Error"; ORYX.I18N.TransformationDownloadDialog.noResult = "The transformation service did not return a result."; ORYX.I18N.TransformationDownloadDialog.errorParsing = "Error During the Parsing of the Diagram."; ORYX.I18N.TransformationDownloadDialog.transResult = "Transformation Results"; ORYX.I18N.TransformationDownloadDialog.showFile = "Show the result file"; ORYX.I18N.TransformationDownloadDialog.downloadFile = "Download the result file"; ORYX.I18N.TransformationDownloadDialog.downloadAll = "Download all result files"; if(!ORYX.I18N.DesynchronizabilityOverlay) ORYX.I18N.DesynchronizabilityOverlay = {}; //TODO desynchronizability is not a correct term ORYX.I18N.DesynchronizabilityOverlay.group = "Overlay"; ORYX.I18N.DesynchronizabilityOverlay.name = "Desynchronizability Checker"; ORYX.I18N.DesynchronizabilityOverlay.desc = "Desynchronizability Checker"; ORYX.I18N.DesynchronizabilityOverlay.sync = "The net is desynchronizable."; ORYX.I18N.DesynchronizabilityOverlay.error = "The net has 1 syntax errors."; ORYX.I18N.DesynchronizabilityOverlay.invalid = "Invalid answer from server."; if(!ORYX.I18N.Edit) ORYX.I18N.Edit = {}; ORYX.I18N.Edit.group = "Edit"; ORYX.I18N.Edit.cut = "Cut"; ORYX.I18N.Edit.cutDesc = "Cut selected shapes (Ctrl+X)"; ORYX.I18N.Edit.copy = "Copy"; ORYX.I18N.Edit.copyDesc = "Copy selected shapes(Ctrl+C)"; ORYX.I18N.Edit.paste = "Paste"; ORYX.I18N.Edit.pasteDesc = "Paste selected shapes(Ctrl+V)"; ORYX.I18N.Edit.del = "Delete"; ORYX.I18N.Edit.delDesc = "Deletes selected shapes (Delete)"; if(!ORYX.I18N.EPCSupport) ORYX.I18N.EPCSupport = {}; ORYX.I18N.EPCSupport.group = "EPC"; ORYX.I18N.EPCSupport.exp = "Export EPC"; ORYX.I18N.EPCSupport.expDesc = "Export diagram to EPML"; ORYX.I18N.EPCSupport.imp = "Import EPC"; ORYX.I18N.EPCSupport.impDesc = "Import an EPML file"; ORYX.I18N.EPCSupport.progressExp = "Exporting model"; ORYX.I18N.EPCSupport.selectFile = "Select an EPML (.empl) file to import."; ORYX.I18N.EPCSupport.file = "File"; ORYX.I18N.EPCSupport.impPanel = "Import EPML File"; ORYX.I18N.EPCSupport.impBtn = "Import"; ORYX.I18N.EPCSupport.close = "Close"; ORYX.I18N.EPCSupport.error = "Error"; ORYX.I18N.EPCSupport.progressImp = "Import..."; if(!ORYX.I18N.ERDFSupport) ORYX.I18N.ERDFSupport = {}; ORYX.I18N.ERDFSupport.exp = "Export to ERDF"; ORYX.I18N.ERDFSupport.expDesc = "Export to ERDF"; ORYX.I18N.ERDFSupport.imp = "Import from ERDF"; ORYX.I18N.ERDFSupport.impDesc = "Import from ERDF"; ORYX.I18N.ERDFSupport.impFailed = "Request for import of ERDF failed."; ORYX.I18N.ERDFSupport.impFailed2 = "An error while importing occurs! <br/>Please check error message: <br/><br/>"; ORYX.I18N.ERDFSupport.error = "Error"; ORYX.I18N.ERDFSupport.noCanvas = "The xml document has no Oryx canvas node included!"; ORYX.I18N.ERDFSupport.noSS = "The Oryx canvas node has no stencil set definition included!"; ORYX.I18N.ERDFSupport.wrongSS = "The given stencil set does not fit to the current editor!"; ORYX.I18N.ERDFSupport.selectFile = "Select an ERDF (.xml) file or type in the ERDF to import it!"; ORYX.I18N.ERDFSupport.file = "File"; ORYX.I18N.ERDFSupport.impERDF = "Import ERDF"; ORYX.I18N.ERDFSupport.impBtn = "Import"; ORYX.I18N.ERDFSupport.impProgress = "Importing..."; ORYX.I18N.ERDFSupport.close = "Close"; ORYX.I18N.ERDFSupport.deprTitle = "Really export to eRDF?"; ORYX.I18N.ERDFSupport.deprText = "Exporting to eRDF is not recommended anymore because the support will be stopped in future versions of the Oryx editor. If possible, export the model to JSON. Do you want to export anyway?"; if(!ORYX.I18N.jPDLSupport) ORYX.I18N.jPDLSupport = {}; ORYX.I18N.jPDLSupport.group = "ExecBPMN"; ORYX.I18N.jPDLSupport.exp = "Export to jPDL"; ORYX.I18N.jPDLSupport.expDesc = "Export to jPDL"; ORYX.I18N.jPDLSupport.imp = "Import from jPDL"; ORYX.I18N.jPDLSupport.impDesc = "Import jPDL File"; ORYX.I18N.jPDLSupport.impFailedReq = "Request for import of jPDL failed."; ORYX.I18N.jPDLSupport.impFailedJson = "Transformation of jPDL failed."; ORYX.I18N.jPDLSupport.impFailedJsonAbort = "Import aborted."; ORYX.I18N.jPDLSupport.loadSseQuestionTitle = "jBPM stencil set extension needs to be loaded"; ORYX.I18N.jPDLSupport.loadSseQuestionBody = "In order to import jPDL, the stencil set extension has to be loaded. Do you want to proceed?"; ORYX.I18N.jPDLSupport.expFailedReq = "Request for export of model failed."; ORYX.I18N.jPDLSupport.expFailedXml = "Export to jPDL failed. Exporter reported: "; ORYX.I18N.jPDLSupport.error = "Error"; ORYX.I18N.jPDLSupport.selectFile = "Select an jPDL (.xml) file or type in the jPDL to import it!"; ORYX.I18N.jPDLSupport.file = "File"; ORYX.I18N.jPDLSupport.impJPDL = "Import jPDL"; ORYX.I18N.jPDLSupport.impBtn = "Import"; ORYX.I18N.jPDLSupport.impProgress = "Importing..."; ORYX.I18N.jPDLSupport.close = "Close"; if(!ORYX.I18N.Bpmn2Bpel) ORYX.I18N.Bpmn2Bpel = {}; ORYX.I18N.Bpmn2Bpel.group = "ExecBPMN"; ORYX.I18N.Bpmn2Bpel.show = "Show transformed BPEL"; ORYX.I18N.Bpmn2Bpel.download = "Download transformed BPEL"; ORYX.I18N.Bpmn2Bpel.deploy = "Deploy transformed BPEL"; ORYX.I18N.Bpmn2Bpel.showDesc = "Transforms BPMN to BPEL and shows the result in a new window."; ORYX.I18N.Bpmn2Bpel.downloadDesc = "Transforms BPMN to BPEL and offers to download the result."; ORYX.I18N.Bpmn2Bpel.deployDesc = "Transforms BPMN to BPEL and deploys the business process on the BPEL-Engine Apache ODE"; ORYX.I18N.Bpmn2Bpel.transfFailed = "Request for transformation to BPEL failed."; ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputTitle = "Apache ODE URL"; ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputLabelDeploy = "Deploy Process"; ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputLabelCancel = "Cancel"; ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputPanelText = "Please type-in the URL to the Apache ODE BPEL-Engine. E.g.: http://myserver:8080/ode"; if(!ORYX.I18N.Save) ORYX.I18N.Save = {}; ORYX.I18N.Save.group = "File"; ORYX.I18N.Save.save = "Save"; ORYX.I18N.Save.saveDesc = "Save"; ORYX.I18N.Save.saveAs = "Save As..."; ORYX.I18N.Save.saveAsDesc = "Save As..."; ORYX.I18N.Save.unsavedData = "There are unsaved data, please save before you leave, otherwise your changes get lost!"; ORYX.I18N.Save.newProcess = "New Process"; ORYX.I18N.Save.saveAsTitle = "Save as..."; ORYX.I18N.Save.saveBtn = "Save"; ORYX.I18N.Save.close = "Close"; ORYX.I18N.Save.savedAs = "Saved As"; ORYX.I18N.Save.saved = "Saved!"; ORYX.I18N.Save.failed = "Saving failed."; ORYX.I18N.Save.noRights = "You have no rights to save changes."; ORYX.I18N.Save.saving = "Saving"; ORYX.I18N.Save.saveAsHint = "The process diagram is stored under:"; if(!ORYX.I18N.File) ORYX.I18N.File = {}; ORYX.I18N.File.group = "File"; ORYX.I18N.File.print = "Print"; ORYX.I18N.File.printDesc = "Print current model"; ORYX.I18N.File.pdf = "Export as PDF"; ORYX.I18N.File.pdfDesc = "Export as PDF"; ORYX.I18N.File.info = "Info"; ORYX.I18N.File.infoDesc = "Info"; ORYX.I18N.File.genPDF = "Generating PDF"; ORYX.I18N.File.genPDFFailed = "Generating PDF failed."; ORYX.I18N.File.printTitle = "Print"; ORYX.I18N.File.printMsg = "We are currently experiencing problems with the printing function. We recommend using the PDF Export to print the diagram. Do you really want to continue printing?"; if(!ORYX.I18N.Grouping) ORYX.I18N.Grouping = {}; ORYX.I18N.Grouping.grouping = "Grouping"; ORYX.I18N.Grouping.group = "Group"; ORYX.I18N.Grouping.groupDesc = "Groups all selected shapes"; ORYX.I18N.Grouping.ungroup = "Ungroup"; ORYX.I18N.Grouping.ungroupDesc = "Deletes the group of all selected Shapes"; if(!ORYX.I18N.IBPMN2BPMN) ORYX.I18N.IBPMN2BPMN = {}; ORYX.I18N.IBPMN2BPMN.group ="Export"; ORYX.I18N.IBPMN2BPMN.name ="IBPMN 2 BPMN Mapping"; ORYX.I18N.IBPMN2BPMN.desc ="Convert IBPMN to BPMN"; if(!ORYX.I18N.Loading) ORYX.I18N.Loading = {}; ORYX.I18N.Loading.waiting ="Please wait..."; if(!ORYX.I18N.Pnmlexport) ORYX.I18N.Pnmlexport = {}; ORYX.I18N.Pnmlexport.group ="Export"; ORYX.I18N.Pnmlexport.name ="BPMN to PNML"; ORYX.I18N.Pnmlexport.desc ="Export as executable PNML and deploy"; if(!ORYX.I18N.PropertyWindow) ORYX.I18N.PropertyWindow = {}; ORYX.I18N.PropertyWindow.name = "Name"; ORYX.I18N.PropertyWindow.value = "Value"; ORYX.I18N.PropertyWindow.selected = "selected"; ORYX.I18N.PropertyWindow.clickIcon = "Click Icon"; ORYX.I18N.PropertyWindow.add = "Add"; ORYX.I18N.PropertyWindow.rem = "Remove"; ORYX.I18N.PropertyWindow.complex = "Editor for a Complex Type"; ORYX.I18N.PropertyWindow.text = "Editor for a Text Type"; ORYX.I18N.PropertyWindow.ok = "Ok"; ORYX.I18N.PropertyWindow.cancel = "Cancel"; ORYX.I18N.PropertyWindow.dateFormat = "m/d/y"; if(!ORYX.I18N.ShapeMenuPlugin) ORYX.I18N.ShapeMenuPlugin = {}; ORYX.I18N.ShapeMenuPlugin.drag = "Drag"; ORYX.I18N.ShapeMenuPlugin.clickDrag = "Click or drag"; ORYX.I18N.ShapeMenuPlugin.morphMsg = "Morph shape"; if(!ORYX.I18N.SimplePnmlexport) ORYX.I18N.SimplePnmlexport = {}; ORYX.I18N.SimplePnmlexport.group = "Export"; ORYX.I18N.SimplePnmlexport.name = "Export to PNML"; ORYX.I18N.SimplePnmlexport.desc = "Export to PNML"; if(!ORYX.I18N.StepThroughPlugin) ORYX.I18N.StepThroughPlugin = {}; ORYX.I18N.StepThroughPlugin.group = "Step Through"; ORYX.I18N.StepThroughPlugin.stepThrough = "Step Through"; ORYX.I18N.StepThroughPlugin.stepThroughDesc = "Step through your model"; ORYX.I18N.StepThroughPlugin.undo = "Undo"; ORYX.I18N.StepThroughPlugin.undoDesc = "Undo one Step"; ORYX.I18N.StepThroughPlugin.error = "Can't step through this diagram."; ORYX.I18N.StepThroughPlugin.executing = "Executing"; if(!ORYX.I18N.SyntaxChecker) ORYX.I18N.SyntaxChecker = {}; ORYX.I18N.SyntaxChecker.group = "Verification"; ORYX.I18N.SyntaxChecker.name = "Syntax Checker"; ORYX.I18N.SyntaxChecker.desc = "Check Syntax"; ORYX.I18N.SyntaxChecker.noErrors = "There are no syntax errors."; ORYX.I18N.SyntaxChecker.invalid = "Invalid answer from server."; ORYX.I18N.SyntaxChecker.checkingMessage = "Checking ..."; if(!ORYX.I18N.Undo) ORYX.I18N.Undo = {}; ORYX.I18N.Undo.group = "Undo"; ORYX.I18N.Undo.undo = "Undo"; ORYX.I18N.Undo.undoDesc = "Undo (Ctrl+Z)"; ORYX.I18N.Undo.redo = "Redo"; ORYX.I18N.Undo.redoDesc = "Redo (Ctrl+Y)"; if(!ORYX.I18N.Validator) ORYX.I18N.Validator = {}; ORYX.I18N.Validator.checking = "Checking"; if(!ORYX.I18N.View) ORYX.I18N.View = {}; ORYX.I18N.View.group = "Zoom"; ORYX.I18N.View.zoomIn = "Zoom In"; ORYX.I18N.View.zoomInDesc = "Zoom in"; ORYX.I18N.View.zoomOut = "Zoom Out"; ORYX.I18N.View.zoomOutDesc = "Zoom out"; ORYX.I18N.View.zoomStandard = "Zoom Standard"; ORYX.I18N.View.zoomStandardDesc = "Zoom to 100%"; ORYX.I18N.View.zoomFitToModel = "Zoom fit to model"; ORYX.I18N.View.zoomFitToModelDesc = "Zoom to show entire model"; if(!ORYX.I18N.XFormsSerialization) ORYX.I18N.XFormsSerialization = {}; ORYX.I18N.XFormsSerialization.group = "XForms Serialization"; ORYX.I18N.XFormsSerialization.exportXForms = "XForms Export"; ORYX.I18N.XFormsSerialization.exportXFormsDesc = "Export XForms+XHTML markup"; ORYX.I18N.XFormsSerialization.importXForms = "XForms Import"; ORYX.I18N.XFormsSerialization.importXFormsDesc = "Import XForms+XHTML markup"; ORYX.I18N.XFormsSerialization.noClientXFormsSupport = "No XForms support"; ORYX.I18N.XFormsSerialization.noClientXFormsSupportDesc = "<h2>Your browser does not support XForms. Please install the <a href=\"https://addons.mozilla.org/firefox/addon/824\" target=\"_blank\">Mozilla XForms Add-on</a> for Firefox.</h2>"; ORYX.I18N.XFormsSerialization.ok = "Ok"; ORYX.I18N.XFormsSerialization.selectFile = "Select a XHTML (.xhtml) file or type in the XForms+XHTML markup to import it!"; ORYX.I18N.XFormsSerialization.selectCss = "Please insert url of css file"; ORYX.I18N.XFormsSerialization.file = "File"; ORYX.I18N.XFormsSerialization.impFailed = "Request for import of document failed."; ORYX.I18N.XFormsSerialization.impTitle = "Import XForms+XHTML document"; ORYX.I18N.XFormsSerialization.expTitle = "Export XForms+XHTML document"; ORYX.I18N.XFormsSerialization.impButton = "Import"; ORYX.I18N.XFormsSerialization.impProgress = "Importing..."; ORYX.I18N.XFormsSerialization.close = "Close"; if(!ORYX.I18N.TreeGraphSupport) ORYX.I18N.TreeGraphSupport = {}; ORYX.I18N.TreeGraphSupport.syntaxCheckName = "Syntax Check"; ORYX.I18N.TreeGraphSupport.group = "Tree Graph Support"; ORYX.I18N.TreeGraphSupport.syntaxCheckDesc = "Check the syntax of an tree graph structure"; if(!ORYX.I18N.QueryEvaluator) ORYX.I18N.QueryEvaluator = {}; ORYX.I18N.QueryEvaluator.name = "Query Evaluator"; ORYX.I18N.QueryEvaluator.group = "Verification"; ORYX.I18N.QueryEvaluator.desc = "Evaluate query"; ORYX.I18N.QueryEvaluator.noResult = "Query resulted in no match."; ORYX.I18N.QueryEvaluator.invalidResponse = "Invalid answer from server."; // if(!ORYX.I18N.QueryResultHighlighter) ORYX.I18N.QueryResultHighlighter = {}; // // ORYX.I18N.QueryResultHighlighter.name = "Query Result Highlighter"; /** New Language Properties: 08.12.2008 */ ORYX.I18N.PropertyWindow.title = "Properties"; if(!ORYX.I18N.ShapeRepository) ORYX.I18N.ShapeRepository = {}; ORYX.I18N.ShapeRepository.title = "Shape Repository"; ORYX.I18N.Save.dialogDesciption = "Please enter a name, a description and a comment."; ORYX.I18N.Save.dialogLabelTitle = "Title"; ORYX.I18N.Save.dialogLabelDesc = "Description"; ORYX.I18N.Save.dialogLabelType = "Type"; ORYX.I18N.Save.dialogLabelComment = "Revision comment"; ORYX.I18N.Validator.name = "BPMN Validator"; ORYX.I18N.Validator.description = "Validation for BPMN"; ORYX.I18N.SSExtensionLoader.labelImport = "Import"; ORYX.I18N.SSExtensionLoader.labelCancel = "Cancel"; Ext.MessageBox.buttonText.yes = "Yes"; Ext.MessageBox.buttonText.no = "No"; Ext.MessageBox.buttonText.cancel = "Cancel"; Ext.MessageBox.buttonText.ok = "OK"; /** New Language Properties: 28.01.2009 */ if(!ORYX.I18N.BPMN2XPDL) ORYX.I18N.BPMN2XPDL = {}; ORYX.I18N.BPMN2XPDL.group = "Export"; ORYX.I18N.BPMN2XPDL.xpdlExport = "Export to XPDL"; /** Resource Perspective Additions: 24 March 2009 */ if(!ORYX.I18N.ResourcesSoDAdd) ORYX.I18N.ResourcesSoDAdd = {}; ORYX.I18N.ResourcesSoDAdd.name = "Define Separation of Duties Contraint"; ORYX.I18N.ResourcesSoDAdd.group = "Resource Perspective"; ORYX.I18N.ResourcesSoDAdd.desc = "Define a Separation of Duties constraint for the selected tasks"; if(!ORYX.I18N.ResourcesSoDShow) ORYX.I18N.ResourcesSoDShow = {}; ORYX.I18N.ResourcesSoDShow.name = "Show Separation of Duties Constraints"; ORYX.I18N.ResourcesSoDShow.group = "Resource Perspective"; ORYX.I18N.ResourcesSoDShow.desc = "Show Separation of Duties constraints of the selected task"; if(!ORYX.I18N.ResourcesBoDAdd) ORYX.I18N.ResourcesBoDAdd = {}; ORYX.I18N.ResourcesBoDAdd.name = "Define Binding of Duties Constraint"; ORYX.I18N.ResourcesBoDAdd.group = "Resource Perspective"; ORYX.I18N.ResourcesBoDAdd.desc = "Define a Binding of Duties Constraint for the selected tasks"; if(!ORYX.I18N.ResourcesBoDShow) ORYX.I18N.ResourcesBoDShow = {}; ORYX.I18N.ResourcesBoDShow.name = "Show Binding of Duties Constraints"; ORYX.I18N.ResourcesBoDShow.group = "Resource Perspective"; ORYX.I18N.ResourcesBoDShow.desc = "Show Binding of Duties constraints of the selected task"; if(!ORYX.I18N.ResourceAssignment) ORYX.I18N.ResourceAssignment = {}; ORYX.I18N.ResourceAssignment.name = "Resource Assignment"; ORYX.I18N.ResourceAssignment.group = "Resource Perspective"; ORYX.I18N.ResourceAssignment.desc = "Assign resources to the selected task(s)"; if(!ORYX.I18N.ClearSodBodHighlights) ORYX.I18N.ClearSodBodHighlights = {}; ORYX.I18N.ClearSodBodHighlights.name = "Clear Highlights and Overlays"; ORYX.I18N.ClearSodBodHighlights.group = "Resource Perspective"; ORYX.I18N.ClearSodBodHighlights.desc = "Remove all Separation and Binding of Duties Highlights/ Overlays"; if(!ORYX.I18N.Perspective) ORYX.I18N.Perspective = {}; ORYX.I18N.Perspective.no = "No Perspective" ORYX.I18N.Perspective.noTip = "Unload the current perspective" /** New Language Properties: 21.04.2009 */ ORYX.I18N.JSONSupport = { imp: { name: "Import from JSON", desc: "Imports a model from JSON", group: "Export", selectFile: "Select an JSON (.json) file or type in JSON to import it!", file: "File", btnImp: "Import", btnClose: "Close", progress: "Importing ...", syntaxError: "Syntax error" }, exp: { name: "Export to JSON", desc: "Exports current model to JSON", group: "Export" } }; /** New Language Properties: 08.05.2009 */ if(!ORYX.I18N.BPMN2XHTML) ORYX.I18N.BPMN2XHTML = {}; ORYX.I18N.BPMN2XHTML.group = "Export"; ORYX.I18N.BPMN2XHTML.XHTMLExport = "Export XHTML Documentation"; /** New Language Properties: 09.05.2009 */ if(!ORYX.I18N.JSONImport) ORYX.I18N.JSONImport = {}; ORYX.I18N.JSONImport.title = "JSON Import"; ORYX.I18N.JSONImport.wrongSS = "The stencil set of the imported file ({0}) does not match to the loaded stencil set ({1})." if(!ORYX.I18N.Feedback) ORYX.I18N.Feedback = {}; ORYX.I18N.Feedback.name = "Feedback"; ORYX.I18N.Feedback.desc = "Contact us for any kind of feedback!"; ORYX.I18N.Feedback.pTitle = "Contact us for any kind of feedback!"; ORYX.I18N.Feedback.pName = "Name"; ORYX.I18N.Feedback.pEmail = "E-Mail"; ORYX.I18N.Feedback.pSubject = "Subject"; ORYX.I18N.Feedback.pMsg = "Description/Message"; ORYX.I18N.Feedback.pEmpty = "* Please provide as detailed information as possible so that we can understand your request.\n* For bug reports, please list the steps how to reproduce the problem and describe the output you expected."; ORYX.I18N.Feedback.pAttach = "Attach current model"; ORYX.I18N.Feedback.pAttachDesc = "This information can be helpful for debugging purposes. If your model contains some sensitive data, remove it before or uncheck this behavior."; ORYX.I18N.Feedback.pBrowser = "Information about your browser and environment"; ORYX.I18N.Feedback.pBrowserDesc = "This information has been auto-detected from your browser. It can be helpful if you encountered a bug associated with browser-specific behavior."; ORYX.I18N.Feedback.submit = "Send Message"; ORYX.I18N.Feedback.sending = "Sending message ..."; ORYX.I18N.Feedback.success = "Success"; ORYX.I18N.Feedback.successMsg = "Thank you for your feedback!"; ORYX.I18N.Feedback.failure = "Failure"; ORYX.I18N.Feedback.failureMsg = "Unfortunately, the message could not be sent. This is our fault! Please try again or contact someone at http://code.google.com/p/oryx-editor/"; ORYX.I18N.Feedback.name = "Feedback"; ORYX.I18N.Feedback.failure = "Failure"; ORYX.I18N.Feedback.failureMsg = "Unfortunately, the message could not be sent. This is our fault! Please try again or contact someone at http://code.google.com/p/oryx-editor/"; ORYX.I18N.Feedback.submit = "Send Message"; ORYX.I18N.Feedback.emailDesc = "Your e-mail address?"; ORYX.I18N.Feedback.titleDesc = "Summarize your message with a short title"; ORYX.I18N.Feedback.descriptionDesc = "Describe your idea, question, or problem." ORYX.I18N.Feedback.info = '<p>Oryx is a research platform intended to support scientists in the field of business process management and beyond with a flexible, extensible tool to validate research theses and conduct experiments.</p><p>We are happy to provide you with the <a href="http://bpt.hpi.uni-potsdam.de/Oryx/ReleaseNotes" target="_blank"> latest technology and advancements</a> of our platform. <a href="http://bpt.hpi.uni-potsdam.de/Oryx/DeveloperNetwork" target="_blank">We</a> work hard to provide you with a reliable system, even though you may experience small hiccups from time to time.</p><p>If you have ideas how to improve Oryx, have a question related to the platform, or want to report a problem: <strong>Please, let us know. Here.</strong></p>'; // general info will be shown, if no subject specific info is given // list subjects in reverse order of appearance! ORYX.I18N.Feedback.subjects = [ { id: "question", // ansi-compatible name name: "Question", // natural name description: "Ask your question here! \nPlease give us as much information as possible, so we don't have to bother you with more questions, before we can give an answer.", // default text for the description text input field info: "" // optional field to give more info }, { id: "problem", // ansi-compatible name name: "Problem", // natural name description: "We're sorry for the inconvenience. Give us feedback on the problem, and we'll try to solve it for you. Describe it as detailed as possible, please.", // default text for the description text input field info: "" // optional field to give more info }, { id: "idea", // ansi-compatible name name: "Idea", // natural name description: "Share your ideas and thoughts here!", // default text for the description text input field info: "" // optional field to give more info } ]; /** New Language Properties: 11.05.2009 */ if(!ORYX.I18N.BPMN2DTRPXMI) ORYX.I18N.BPMN2DTRPXMI = {}; ORYX.I18N.BPMN2DTRPXMI.group = "Export"; ORYX.I18N.BPMN2DTRPXMI.DTRPXMIExport = "Export to XMI (Design Thinking)"; ORYX.I18N.BPMN2DTRPXMI.DTRPXMIExportDescription = "Exports current model to XMI (requires stencil set extension 'BPMN Subset for Design Thinking')"; /** New Language Properties: 14.05.2009 */ if(!ORYX.I18N.RDFExport) ORYX.I18N.RDFExport = {}; ORYX.I18N.RDFExport.group = "Export"; ORYX.I18N.RDFExport.rdfExport = "Export to RDF"; ORYX.I18N.RDFExport.rdfExportDescription = "Exports current model to the XML serialization defined for the Resource Description Framework (RDF)"; /** New Language Properties: 15.05.2009*/ if(!ORYX.I18N.SyntaxChecker.BPMN) ORYX.I18N.SyntaxChecker.BPMN={}; ORYX.I18N.SyntaxChecker.BPMN_NO_SOURCE = "An edge must have a source."; ORYX.I18N.SyntaxChecker.BPMN_NO_TARGET = "An edge must have a target."; ORYX.I18N.SyntaxChecker.BPMN_DIFFERENT_PROCESS = "Source and target node must be contained in the same process."; ORYX.I18N.SyntaxChecker.BPMN_SAME_PROCESS = "Source and target node must be contained in different pools."; ORYX.I18N.SyntaxChecker.BPMN_FLOWOBJECT_NOT_CONTAINED_IN_PROCESS = "A flow object must be contained in a process."; ORYX.I18N.SyntaxChecker.BPMN_ENDEVENT_WITHOUT_INCOMING_CONTROL_FLOW = "An end event must have an incoming sequence flow."; ORYX.I18N.SyntaxChecker.BPMN_STARTEVENT_WITHOUT_OUTGOING_CONTROL_FLOW = "A start event must have an outgoing sequence flow."; ORYX.I18N.SyntaxChecker.BPMN_STARTEVENT_WITH_INCOMING_CONTROL_FLOW = "Start events must not have incoming sequence flows."; ORYX.I18N.SyntaxChecker.BPMN_ATTACHEDINTERMEDIATEEVENT_WITH_INCOMING_CONTROL_FLOW = "Attached intermediate events must not have incoming sequence flows."; ORYX.I18N.SyntaxChecker.BPMN_ATTACHEDINTERMEDIATEEVENT_WITHOUT_OUTGOING_CONTROL_FLOW = "Attached intermediate events must have exactly one outgoing sequence flow."; ORYX.I18N.SyntaxChecker.BPMN_ENDEVENT_WITH_OUTGOING_CONTROL_FLOW = "End events must not have outgoing sequence flows."; ORYX.I18N.SyntaxChecker.BPMN_EVENTBASEDGATEWAY_BADCONTINUATION = "Event-based gateways must not be followed by gateways or subprocesses."; ORYX.I18N.SyntaxChecker.BPMN_NODE_NOT_ALLOWED = "Node type is not allowed."; if(!ORYX.I18N.SyntaxChecker.IBPMN) ORYX.I18N.SyntaxChecker.IBPMN={}; ORYX.I18N.SyntaxChecker.IBPMN_NO_ROLE_SET = "Interactions must have a sender and a receiver role set"; ORYX.I18N.SyntaxChecker.IBPMN_NO_INCOMING_SEQFLOW = "This node must have incoming sequence flow."; ORYX.I18N.SyntaxChecker.IBPMN_NO_OUTGOING_SEQFLOW = "This node must have outgoing sequence flow."; if(!ORYX.I18N.SyntaxChecker.InteractionNet) ORYX.I18N.SyntaxChecker.InteractionNet={}; ORYX.I18N.SyntaxChecker.InteractionNet_SENDER_NOT_SET = "Sender not set"; ORYX.I18N.SyntaxChecker.InteractionNet_RECEIVER_NOT_SET = "Receiver not set"; ORYX.I18N.SyntaxChecker.InteractionNet_MESSAGETYPE_NOT_SET = "Message type not set"; ORYX.I18N.SyntaxChecker.InteractionNet_ROLE_NOT_SET = "Role not set"; if(!ORYX.I18N.SyntaxChecker.EPC) ORYX.I18N.SyntaxChecker.EPC={}; ORYX.I18N.SyntaxChecker.EPC_NO_SOURCE = "Each edge must have a source."; ORYX.I18N.SyntaxChecker.EPC_NO_TARGET = "Each edge must have a target."; ORYX.I18N.SyntaxChecker.EPC_NOT_CONNECTED = "Node must be connected with edges."; ORYX.I18N.SyntaxChecker.EPC_NOT_CONNECTED_2 = "Node must be connected with more edges."; ORYX.I18N.SyntaxChecker.EPC_TOO_MANY_EDGES = "Node has too many connected edges."; ORYX.I18N.SyntaxChecker.EPC_NO_CORRECT_CONNECTOR = "Node is no correct connector."; ORYX.I18N.SyntaxChecker.EPC_MANY_STARTS = "There must be only one start event."; ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_OR = "There must be no functions after a splitting OR/XOR."; ORYX.I18N.SyntaxChecker.EPC_PI_AFTER_OR = "There must be no process interface after a splitting OR/XOR."; ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_FUNCTION = "There must be no function after a function."; ORYX.I18N.SyntaxChecker.EPC_EVENT_AFTER_EVENT = "There must be no event after an event."; ORYX.I18N.SyntaxChecker.EPC_PI_AFTER_FUNCTION = "There must be no process interface after a function."; ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_PI = "There must be no function after a process interface."; if(!ORYX.I18N.SyntaxChecker.PetriNet) ORYX.I18N.SyntaxChecker.PetriNet={}; ORYX.I18N.SyntaxChecker.PetriNet_NOT_BIPARTITE = "The graph is not bipartite"; ORYX.I18N.SyntaxChecker.PetriNet_NO_LABEL = "Label not set for a labeled transition"; ORYX.I18N.SyntaxChecker.PetriNet_NO_ID = "There is a node without id"; ORYX.I18N.SyntaxChecker.PetriNet_SAME_SOURCE_AND_TARGET = "Two flow relationships have the same source and target"; ORYX.I18N.SyntaxChecker.PetriNet_NODE_NOT_SET = "A node is not set for a flowrelationship"; /** New Language Properties: 02.06.2009*/ ORYX.I18N.Edge = "Edge"; ORYX.I18N.Node = "Node"; /** New Language Properties: 03.06.2009*/ ORYX.I18N.SyntaxChecker.notice = "Move the mouse over a red cross icon to see the error message."; ORYX.I18N.Validator.result = "Validation Result"; ORYX.I18N.Validator.noErrors = "No validation errors found."; ORYX.I18N.Validator.bpmnDeadlockTitle = "Deadlock"; ORYX.I18N.Validator.bpmnDeadlock = "This node results in a deadlock. There are situations where not all incoming branches are activated."; ORYX.I18N.Validator.bpmnUnsafeTitle = "Lack of synchronization"; ORYX.I18N.Validator.bpmnUnsafe = "This model suffers from lack of synchronization. The marked element is activated from multiple incoming branches."; ORYX.I18N.Validator.bpmnLeadsToNoEndTitle = "Validation Result"; ORYX.I18N.Validator.bpmnLeadsToNoEnd = "The process will never reach a final state."; ORYX.I18N.Validator.syntaxErrorsTitle = "Syntax Error"; ORYX.I18N.Validator.syntaxErrorsMsg = "The process cannot be validated because it contains syntax errors."; ORYX.I18N.Validator.error = "Validation failed"; ORYX.I18N.Validator.errorDesc = 'We are sorry, but the validation of your process failed. It would help us identifying the problem, if you sent us your process model via the "Send Feedback" function.'; ORYX.I18N.Validator.epcIsSound = "<p><b>The EPC is sound, no problems found!</b></p>"; ORYX.I18N.Validator.epcNotSound = "<p><b>The EPC is <i>NOT</i> sound!</b></p>"; /** New Language Properties: 05.06.2009*/ if(!ORYX.I18N.RESIZE) ORYX.I18N.RESIZE = {}; ORYX.I18N.RESIZE.tipGrow = "Increase canvas size: "; ORYX.I18N.RESIZE.tipShrink = "Decrease canvas size: "; ORYX.I18N.RESIZE.N = "Top"; ORYX.I18N.RESIZE.W = "Left"; ORYX.I18N.RESIZE.S ="Down"; ORYX.I18N.RESIZE.E ="Right"; /** New Language Properties: 14.08.2009*/ if(!ORYX.I18N.PluginLoad) ORYX.I18N.PluginLoad = {}; ORYX.I18N.PluginLoad.AddPluginButtonName = "Add Plugins"; ORYX.I18N.PluginLoad.AddPluginButtonDesc = "Add additional Plugins dynamically"; ORYX.I18N.PluginLoad.loadErrorTitle="Loading Error"; ORYX.I18N.PluginLoad.loadErrorDesc = "Unable to load Plugin. \n Error:\n"; ORYX.I18N.PluginLoad.WindowTitle ="Add additional Plugins"; ORYX.I18N.PluginLoad.NOTUSEINSTENCILSET = "Not allowed in this Stencilset!"; ORYX.I18N.PluginLoad.REQUIRESTENCILSET = "Require another Stencilset!"; ORYX.I18N.PluginLoad.NOTFOUND = "Pluginname not found!" ORYX.I18N.PluginLoad.YETACTIVATED = "Plugin is yet activated!" /** New Language Properties: 15.07.2009*/ if(!ORYX.I18N.Layouting) ORYX.I18N.Layouting ={}; ORYX.I18N.Layouting.doing = "Layouting..."; /** New Language Properties: 18.08.2009*/ ORYX.I18N.SyntaxChecker.MULT_ERRORS = "Multiple Errors"; /** New Language Properties: 08.09.2009*/ if(!ORYX.I18N.PropertyWindow) ORYX.I18N.PropertyWindow = {}; ORYX.I18N.PropertyWindow.oftenUsed = "Often used"; ORYX.I18N.PropertyWindow.moreProps = "More Properties"; /** New Language Properties: 17.09.2009*/ if(!ORYX.I18N.Bpmn2_0Serialization) ORYX.I18N.Bpmn2_0Serialization = {}; ORYX.I18N.Bpmn2_0Serialization.show = "Show BPMN 2.0 DI XML"; ORYX.I18N.Bpmn2_0Serialization.showDesc = "Show BPMN 2.0 DI XML of the current BPMN 2.0 model"; ORYX.I18N.Bpmn2_0Serialization.download = "Download BPMN 2.0 DI XML"; ORYX.I18N.Bpmn2_0Serialization.downloadDesc = "Download BPMN 2.0 DI XML of the current BPMN 2.0 model"; ORYX.I18N.Bpmn2_0Serialization.serialFailed = "An error occurred while generating the BPMN 2.0 DI XML Serialization."; ORYX.I18N.Bpmn2_0Serialization.group = "BPMN 2.0"; /** New Language Properties 01.10.2009 */ if(!ORYX.I18N.SyntaxChecker.BPMN2) ORYX.I18N.SyntaxChecker.BPMN2 = {}; ORYX.I18N.SyntaxChecker.BPMN2_DATA_INPUT_WITH_INCOMING_DATA_ASSOCIATION = "A Data Input must not have any incoming Data Associations."; ORYX.I18N.SyntaxChecker.BPMN2_DATA_OUTPUT_WITH_OUTGOING_DATA_ASSOCIATION = "A Data Output must not have any outgoing Data Associations."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_TARGET_WITH_TOO_MANY_INCOMING_SEQUENCE_FLOWS = "Targets of Event-based Gateways may only have one incoming Sequence Flow."; /** New Language Properties 02.10.2009 */ ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WITH_TOO_LESS_OUTGOING_SEQUENCE_FLOWS = "An Event-based Gateway must have two or more outgoing Sequence Flows."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_EVENT_TARGET_CONTRADICTION = "If Message Intermediate Events are used in the configuration, then Receive Tasks must not be used and vice versa."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WRONG_TRIGGER = "Only the following Intermediate Event triggers are valid: Message, Signal, Timer, Conditional and Multiple."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WRONG_CONDITION_EXPRESSION = "The outgoing Sequence Flows of the Event Gateway must not have a condition expression."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_NOT_INSTANTIATING = "The Gateway does not meet the conditions to instantiate the process. Please use a start event or an instantiating attribute for the gateway."; /** New Language Properties 05.10.2009 */ ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_MIXED_FAILURE = "The Gateway must have both multiple incoming and outgoing Sequence Flows."; ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_CONVERGING_FAILURE = "The Gateway must have multiple incoming but most NOT have multiple outgoing Sequence Flows."; ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_DIVERGING_FAILURE = "The Gateway must NOT have multiple incoming but must have multiple outgoing Sequence Flows."; ORYX.I18N.SyntaxChecker.BPMN2_GATEWAY_WITH_NO_OUTGOING_SEQUENCE_FLOW = "A Gateway must have a minimum of one outgoing Sequence Flow."; ORYX.I18N.SyntaxChecker.BPMN2_RECEIVE_TASK_WITH_ATTACHED_EVENT = "Receive Tasks used in Event Gateway configurations must not have any attached Intermediate Events."; ORYX.I18N.SyntaxChecker.BPMN2_EVENT_SUBPROCESS_BAD_CONNECTION = "An Event Subprocess must not have any incoming or outgoing Sequence Flow."; /** New Language Properties 13.10.2009 */ ORYX.I18N.SyntaxChecker.BPMN_MESSAGE_FLOW_NOT_CONNECTED = "At least one side of the Message Flow has to be connected."; /** New Language Properties 19.10.2009 */ ORYX.I18N.Bpmn2_0Serialization['import'] = "Import from BPMN 2.0 DI XML"; ORYX.I18N.Bpmn2_0Serialization.importDesc = "Import a BPMN 2.0 model from a file or XML String"; ORYX.I18N.Bpmn2_0Serialization.selectFile = "Select a (*.bpmn) file or type in BPMN 2.0 DI XML to import it!"; ORYX.I18N.Bpmn2_0Serialization.file = "File:"; ORYX.I18N.Bpmn2_0Serialization.name = "Import from BPMN 2.0 DI XML"; ORYX.I18N.Bpmn2_0Serialization.btnImp = "Import"; ORYX.I18N.Bpmn2_0Serialization.progress = "Importing BPMN 2.0 DI XML ..."; ORYX.I18N.Bpmn2_0Serialization.btnClose = "Close"; ORYX.I18N.Bpmn2_0Serialization.error = "An error occurred while importing BPMN 2.0 DI XML"; /** New Language Properties 24.11.2009 */ ORYX.I18N.SyntaxChecker.BPMN2_TOO_MANY_INITIATING_MESSAGES = "A Choreography Activity may only have one initiating message."; ORYX.I18N.SyntaxChecker.BPMN_MESSAGE_FLOW_NOT_ALLOWED = "A Message Flow is not allowed here."; /** New Language Properties 27.11.2009 */ ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WITH_TOO_LESS_INCOMING_SEQUENCE_FLOWS = "An Event-based Gateway that is not instantiating must have a minimum of one incoming Sequence Flow."; ORYX.I18N.SyntaxChecker.BPMN2_TOO_FEW_INITIATING_PARTICIPANTS = "A Choreography Activity must have one initiating Participant (white)."; ORYX.I18N.SyntaxChecker.BPMN2_TOO_MANY_INITIATING_PARTICIPANTS = "A Choreography Acitivity must not have more than one initiating Participant (white)." ORYX.I18N.SyntaxChecker.COMMUNICATION_AT_LEAST_TWO_PARTICIPANTS = "The communication must be connected to at least two participants."; ORYX.I18N.SyntaxChecker.MESSAGEFLOW_START_MUST_BE_PARTICIPANT = "The message flow's source must be a participant."; ORYX.I18N.SyntaxChecker.MESSAGEFLOW_END_MUST_BE_PARTICIPANT = "The message flow's target must be a participant."; ORYX.I18N.SyntaxChecker.CONV_LINK_CANNOT_CONNECT_CONV_NODES = "The conversation link must connect a communication or sub conversation node with a participant."; /** New Language Properties 30.12.2009 */ ORYX.I18N.Bpmn2_0Serialization.xpdlShow = "Show XPDL 2.2"; ORYX.I18N.Bpmn2_0Serialization.xpdlShowDesc = "Shows the XPDL 2.2 based on BPMN 2.0 XML (by XSLT)"; ORYX.I18N.Bpmn2_0Serialization.xpdlDownload = "Download as XPDL 2.2"; ORYX.I18N.Bpmn2_0Serialization.xpdlDownloadDesc = "Download the XPDL 2.2 based on BPMN 2.0 XML (by XSLT)"; /** New Language Properties 27.4.2010 */ if(!ORYX.I18N.Paint) ORYX.I18N.Paint = {}; ORYX.I18N.Paint.paint = "Paint"; ORYX.I18N.Paint.paintDesc = "Toggle Paint mode"; /** New Language Properties 26.07.2010 */ if(!ORYX.I18N.JSONExport) ORYX.I18N.JSONExport = {}; ORYX.I18N.JSONExport.name = "JSON Export"; ORYX.I18N.JSONExport.desc = "Export model to the ORYX editor"; ORYX.I18N.JSONExport.group = "Export";
08to09-processwave
oryx/editor/data/i18n/translation_en_us.js
JavaScript
mit
46,690
.processdata { display:none; } /* Fix for Firefox 3 */ .x-date-middle { width: 160px; } .x-grid3 table { table-layout:fixed; } /* Hide tiny small blue dot on the lower top of a menu */ .x-menu { overflow:hidden; } .x-grid3-row-table { table-layout: fixed; } .ext_specialize_gridPanel_aml { } .x-grid3-scroller { padding-bottom: 24px; overflow: hidden; } .x_form_text_set_absolute { position:absolute; top:-500px; left:-500px; } .ext-gecko .x-window-body div.ext_specific_window_overflow.x-form-item { overflow:hidden; } .ext-gecko .x-window-body div.ext_specific_window_overflow.x-form-item .x-form-element { padding-left:60px; } .icon-large { width:18px !important; } .prop-background-color { border:1px solid #ACA899; height:10px; width:10px; } #oryx_editor_header { background-image: url('../images/header_bg.small.gif'); background-position: top center; background-repeat: repeat-x; position: absolute; width: 100%; height: 30px; } .x-panel-editor-north .x-panel-body .x-panel-body, .x-panel-editor-north .x-panel-body .x-panel-bwrap { overflow:visible; } #oryx_editor_header .openid{ font-family:tahoma; font-size:11px; position:absolute; right:15px; top:8px; } #oryx_editor_header .openid.not{ color:#666666; font-style:italic; } #oryx_editor_header .mashupinfo{ margin-left:8px; position:relative; top:3px; vertical-align:top; } #oryx_editor_header .mashupinfo img{ margin-left:5px; width:14px; } .LoadingIndicator, .StatusIndicator { font-family:Verdana; font-size:11px; display:block; background: white no-repeat 8px; padding:5px; padding-left:30px; position:fixed; top:0px; left:0px; border:1px solid silver; white-space:nowrap; opacity:0.6; } .LoadingIndicator { background-image: url('../lib/ext-2.0.2/resources/images/default/grid/loading.gif'); } .StatusIndicator { padding-left:10px; } #oryxcanvas { width:1200px; height:550px; } .ORYX_Editor { /*background:url(../images/controls/background.bmp);*/ background: #EEF1FE; width:1200px; height:550px; border:0px; -moz-box-shadow: 4px 4px 6px black; -webkit-box-shadow: 4px 4px 6px black; box-shadow: 4px 4px 6px black; } .x-layout-panel-center { background:#888888; } .x-layout-panel-center .x-layout-panel-body { padding:20px; } .x-form-field-wrap .x-form-color-trigger { background:transparent url("../lib/ext-2.0.2/resources/images/default/form/color-trigger.png") no-repeat 0 0; cursor:pointer; } .ie6 .x-form-field-wrap .x-form-color-trigger { background:transparent url("../lib/ext-2.0.2/resources/images/default/form/color-trigger.gif") no-repeat 0 0; } /* extended by Kerstin (start)*/ .x-form-field-wrap .x-form-complex-trigger { background:transparent url("../images/complex-trigger.gif") no-repeat 0 0; cursor:pointer; } /* extended by Kerstin (end)*/ .x-dd-drag-ghost { opacity:1.0; } .x-dd-drag-proxy .x-tree-node-leaf { padding-left:15px; padding-right:5px; } .headerShapeRep, .headerShapeRepChild{ background:#eee url("../images/bg.gif") repeat-x; margin-top:1px; border-top:1px solid #ddd; border-bottom:1px solid #ccc; padding-top:3px; padding-bottom:0px; font-size:12px; font-weight:bold; font-family: 'Lucida Grande', 'Tahoma', sans-serif; } .x-tree-root-node > .x-tree-node { margin-bottom:4px; } .headerShapeRep *, .headerShapeRepChild *{ cursor:default; } .headerShapeRepChild { font-size:10px; height:16px; padding-top:0px; } .shaperepository .x-tree-node-indent *{ width:0px; position:relative; } .x-tree-node img.headerShapeRepImg { background:none; width:0px; } .x-tree-ec-icon { position:relative; top:-2px; } .x-tree-node img.ShapeRepEntreeImg, .x-tree-node-leaf img.ShapeRepEntreeImg { height:16px; width:16px; background:none; position:relative; left:-7px; top:-1px; } .x-tree-node .x-tree-selected a span { background:none; color:black; } .ShapeRepEntree{ margin:1px; padding:5px 0px; border:1px solid #f1f1f1; background-color:#f6f6f6; } .ShapeRepEntree, .ShapeRepEntree *{ cursor:move; white-space:normal; } .ShapeRepEntree:hover { border:1px solid #c3daf9; background-color:#ddecfe; } /** Resizer for the Canvas **/ .canvas_resize_indicator_area { margin :auto; display :block; height :30px; left :20%; position :absolute; text-align :center; top :0; width :60%; } .canvas_resize_indicator { width : 15px; height : 15px; position : absolute; display : block; margin : auto; opacity : 0.6; } .canvas_resize_indicator:hover { opacity : 1.0; } .canvas_resize_indicator_grow.S{ left : 50%; bottom : 30px; margin-right: 15px; background : url(../images/arrow-bottom.png) no-repeat center center; } .canvas_resize_indicator_shrink.S{ left : 50%; margin-left : 15px; bottom : 30px; background : url(../images/arrow-top.png) no-repeat center center; } .canvas_resize_indicator_grow.W{ left : 64px; top : 50%; margin-bottom: 15px; background : url(../images/arrow-left.png) no-repeat center center; } .canvas_resize_indicator_shrink.W{ left : 64px; top : 50%; margin-top: 15px; background : url(../images/arrow-right.png) no-repeat center center; } .canvas_resize_indicator_grow.E{ right : 30px; top : 50%; margin-bottom: 15px; background : url(../images/arrow-right.png) no-repeat center center; } .canvas_resize_indicator_shrink.E{ right : 30px; top : 50%; margin-top: 15px; background : url(../images/arrow-left.png) no-repeat center center; } .canvas_resize_indicator_grow.N{ left : 50%; top : 10px; margin-right: 15px; background : url(../images/arrow-top.png) no-repeat center center; } .canvas_resize_indicator_shrink.N{ left : 50%; top : 10px; margin-left : 15px; background : url(../images/arrow-bottom.png) no-repeat center center; } /** End Resizer **/ .Oryx_ShapeMenu .Oryx_MorphItem_disabled { font-weight: bold; cursor:default; opacity:.3; -moz-opacity:.3; filter:alpha(opacity=30); border: 1px solid #000; } .Oryx_hover { background: url(../images/shapemenu_highlight.png) no-repeat 1px 1px; } .Oryx_down { } .Oryx_button img { position:relative; width:16px; height:16px; top:1px; left:1px; } .Oryx_ShapeMenu > .Oryx_Right { margin-top:2px; margin-left:2px; padding-left:0px; padding-right:0px; } .Oryx_ShapeMenu > .Oryx_Left { border-right-width:2px; margin-top:2px; margin-left:13px; padding-left:0px; padding-right:0px; } .Oryx_ShapeMenu > .Oryx_Top { border-bottom-width:2px; margin-top:13px; margin-left:2px; padding-top:0px; padding-bottom:0px; } .Oryx_ShapeMenu > .Oryx_Bottom { border-top-width:2px; margin-top:2px; margin-left:2px; padding-top:0px; padding-bottom:0px; } .Oryx_button img { top:1px; } .Oryx_Left img { top:0px; } .Oryx_button { width:16px; height:16px; padding:4px; position:absolute; } .Oryx_button_with_caption { width:inherit; height:16px; padding:4px; position:absolute; } /*** Resizer ***/ .resizer_southeast { position:relative; background:url(../lib/ext-2.0.2/resources/images/default/sizer/se-handle-dark.gif); width:10px; height:10px; cursor: se-resize; } .resizer_northwest { position:relative; background:url(../lib/ext-2.0.2/resources/images/default/sizer/nw-handle-dark.gif); width:10px; height:10px; cursor: nw-resize; } /*** Selection Frame ***/ .Oryx_SelectionFrame{ position:absolute; border:1px dotted gray; background:none; } /*** Shape Repository ***/ .shapelist { padding:4px; margin:1px; border:1px solid #f1f1f1; background-color:#f6f6f6; } .shapelist *{ cursor:default; } .shapelist img{ margin-top:3px; margin-right:10px; } .shapelist .body{ font:bold 12px 'Lucida Grande', 'Tahoma', sans-serif; overflow:hidden; position:relative; top:-3px; } .shapelist:hover { border:1px solid #c3daf9; background-color:#ddecfe; } /*** Property Window ***/ .propertywindow { width:100% } .propertywindow * { font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size:8pt; border:none; } .propertywindow th, td { border-collapse:collapse; } .propertywindow thead th { background-color:#ddecfe; padding:3px; height:20px; } .propertywindow tbody td { border-top:1px solid #CCCCCC; padding:3px; height:16px; } .propertywindow input { width:100%; } /*** Save Dialog (Copied from model_properties.css) ****/ /****************************************************************************** * forms */ form { font-size: 12px; } form p, form ul { padding: 0px; margin: 10px 0px 0px 10px; list-style-type: none; } form p.info { color: #fc8b03; font-style: italic; text-align : center; } hr { margin: 3px 10px; border: 0px solid #444; border-bottom-width: 1px; } form ul.access li { margin: 0px 3px 3px 3px; } fieldset { border-width: 0px; border-top: 12px solid transparent; padding: 0px 20px; margin: 5px; background-color: #fff; } fieldset legend { margin-left: -17px; font-weight: bold; background-color: #fff; } fieldset .description { color: #666; margin: 0px 0px 3px -17px; font-weight: normal; margin-left: -15px; font-size: 11px; padding-bottom: 2px; } fieldset label { width: 80px; float: left; text-align: right; display: block; margin-top: 3px; } fieldset p { margin: 2px; } fieldset input, fieldset select, fieldset textarea, fieldset .field_with_error_msg, fieldset span.input { display: block; margin-left: 90px; } fieldset input.text, fieldset select, fieldset textarea, fieldset .field_with_error_msg, fieldset span.input { width: 400px; padding: 2px; } fieldset p.inline { margin-left: 90px; margin-bottom: 4px; } fieldset p.inline label { display: inline; float: none; width: default; padding-left: 5px; padding-right: 20px; text-align: left; } fieldset p.inline input { display: inline; margin-left: auto; } fieldset p.inline input.button { margin-right: 20px; } fieldset p.inline .field_with_error_msg { margin-left: 0px; } input.text, select, textarea { border: 1px solid #efefef; background-color: #efefef; } input.text:hover, select:hover, textarea:hover, input.text.activated, select.activated, textarea.activated { border-color: #fc8b03; } input.text.disabled, input.disabled, select.disabled, textarea.disabled, input.text.disabled:hover, input.disabled:hover, select.disabled:hover, textarea.disabled:hover { background-color: #fff; border-color: #fff; color: #000; } .field_with_error { background-color: #f7d4d4 !important; border-color: #c00 !important; } .field_with_error_msg { padding: 2px 0px; font-size: 9pt; color: #c00; } /*** PLUGIN SPECIFIC ***/ /*** PLUGIN: Transform EPC to BPMN **/ .transform-epc-bpmn-window .transform-epc-bpmn-group-button *, .transform-epc-bpmn-group-button.x-btn-pressed * { background:transparent; color:#555555; height:15px; } .transform-epc-bpmn-window *{ font-family:tahoma,arial,helvetica,sans-serif; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-size:11px; } .transform-epc-bpmn-window .transform-epc-bpmn-group-button button { font-size:11px; font-weight:bold; } .transform-epc-bpmn-window .transform-epc-bpmn-group-button .x-btn-center { background:transparent url(../lib/ext-2.0.2/resources/images/default/grid/group-expand-sprite.gif) no-repeat scroll 0px 0px; padding-left:15px; border-bottom:1px solid #CCCCCC; text-align:left; width:100%; } .transform-epc-bpmn-window .transform-epc-bpmn-group-button.x-btn-pressed .x-btn-center { background-position:0px -50px; } .transform-epc-bpmn-window .transform-epc-bpmn-title { border-bottom:1px solid #CCCCCC; margin-bottom:10px; text-align:left; color:#555555; display:block; font-weight:bold; } /*** DEBUG **/ .NewToolbar { display:inline; z-index:10; position:absolute; top:50px; left:800px; background:#CCCCCC; border:1px solid gray; } .NewToolbarButton { display:block; z-index:10; position:relative; top:0px; left:0px; background:#99BBBB; margin:5px; padding:5px; font-size:9px; border:1px solid gray; } .pwave-tab-header { height: 18px; border: 1px solid green; background: -moz-linear-gradient(90deg, #42C142, #49C649); background: -webkit-gradient(linear, left top, left bottom, from(#42C142), to(#49C649)); cursor: pointer; position: relative; } .pwave-tab-header-label { color: white; padding-left: 8px; padding-top: 2px; margin-right: 25px; font-size: 11px; text-align: left; text-overflow: ellipsis; white-space: nowrap; left: 0px; overflow: hidden; width: 205px; position: absolute; } .pwave-tab-header-highlight { height: 1px; width: 100%; border-top: 1px solid #ACD2AC; } .pwave-tab-header-minimize { background-color: #C5EEC5; position: absolute; right: 6px; bottom: 6px; width: 10px; height: 2px; } .pwave-tab-header:hover .pwave-tab-header-minimize { background-color: #FFF; } #pwave-tabbar-wrapper { position: fixed; bottom: 0px; right: 30px; } #pwave-tabbar { width: 238px; position: relative; z-index: 5000; padding: 0px; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-weight: bold; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; border: 0px !important; } #pwave-tabbar .ui-corner-all, #pwave-tabbar .ui-corner-bottom, #pwave-tabbar .ui-corner-top { -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; } #pwave-tabbar .ui-widget-header { background: #d5d6d8; border: 0px; } #pwave-tabbar .ui-tabs-nav { position: absolute !important; background-image: url("../images/toolbar-bg.png"); left: 0px; bottom: 0px; right: 0px; margin: 0px; padding: 0px; } #pwave-tabbar .ui-tabs-nav li { background: url("../images/toolbar-bg.png"); background-position: center top; text-align: center; vertical-align: middle; width: 78px; height: 25px; margin: 0px; padding: 0px; top: 0px; border-left: 1px solid #95979D; border-top: 1px solid #95979D; border-right: 0px; border-bottom: 0px; } #pwave-tabbar .ui-tabs-nav li:last-child { border-right: 1px solid #95979D;; } #pwave-tabbar .ui-tabs-nav li a { font-size: 11px; color: black; padding: 0.3em 0.5em; margin: 0px; line-height: 16px; } #pwave-tabbar .ui-tabs-nav .ui-tabs-selected { border-top: 1px solid transparent; } #pwave-tabbar .ui-tabs-nav .ui-state-hover { padding: 0px; background-color: rgba(0, 164, 0, 0.2); background-image: none; } #pwave-tabbar .ui-tabs-panel { position: absolute; background: #f4f4f4; overflow: hidden; padding: 0px; width: 100%; bottom: 26px; /* must equal #pwave-tabbar .ui-tabs-nav li height */ } #pwave-tabbar .scrollcontainer { max-height: 300px; overflow: auto; border-left: 1px solid #95979D; border-right: 1px solid #95979D; } #tabs-pwave-users .entry { float: left; text-align: left; display: block; width: 100%; height: 45px; border-bottom: 1px solid black; font-family: 'Lucida Grande', 'Tahoma', sans-serif; } #tabs-pwave-users .entry:last-child { border-bottom: 0px; } #tabs-pwave-users .userColor { margin-top: 4px; float: left; height: 37px; width: 15px; } #tabs-pwave-users .userAvatar { float: left; margin: 4px; height: 35px; width: 35px; border: 1px solid black; } #tabs-pwave-users .userAvatar img { width: 100%; height: 100%; } #tabs-pwave-users .userInfo { font-size: 8pt; margin-top : 8px; font-weight: bold; overflow: hidden; white-space: nowrap; } #tabs-pwave-users .userLastActivity { font-size: 8pt; margin-top: 2px; font-weight: normal; } #tabs-pwave-changelog .redolog { background-color: #cccccc; } #tabs-pwave-changelog .entry { float: left; text-align: left; display: block; width: 100%; height: 34px; border-bottom: 1px solid black; background-color: inherit; cursor: pointer; position: relative; } #tabs-pwave-changelog .entry:last-child { border-bottom: 0px; } #tabs-pwave-changelog .userColor { position: relative; margin: 2px 0px; float: left; height: 30px; width: 15px; } #tabs-pwave-changelog .commandName { position: absolute; float: left; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size: 8pt; top : 2px; left : 19px; font-weight: bold; overflow: hidden; white-space: nowrap; } #tabs-pwave-changelog .date { position: absolute; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size: 7pt; font-weight: normal; top : 3px; right : 4px; overflow: hidden; white-space: nowrap; } #tabs-pwave-changelog .time { position: absolute; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size: 7pt; font-weight: normal; bottom: 4px; right: 4px; overflow: hidden; white-space: nowrap; } #tabs-pwave-changelog .username { position: absolute; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size: 8pt; font-weight: normal; bottom: 4px; left: 19px; overflow: hidden; white-space: nowrap; } #tabs-pwave-changelog .empty { height: 23px; text-align: center; padding-top: 15px; font-style: italic; font-size: 8pt; } #pwave-repository { position: fixed; width: 54px; top: 40px; background-color:transparent; } .new-repository-group-stencil { background-image: url("../images/repository-groupstencil-bg.png"); background-color:transparent; background-repeat: no-repeat; background-position: 0px -53px; border: 0px; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-weight: bold; font-size: 8pt; } .new-repository-group-stencil:first-child { background-position: 0px 0px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; } .new-repository-group-stencil:last-child { background-position: 0px -106px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; } .new-repository-group-stencil-bg { height: 53px; background-repeat: no-repeat; background-position: center center; cursor: move; } .new-repository-group-stencil:first-child .new-repository-group-stencil-bg { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; } .new-repository-group-stencil:last-child .new-repository-group-stencil-bg { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; } .new-repository-group-stencil-bg:hover { background-color: rgba(0, 157, 0, 0.2); } .new-repository-group { display: none; position: fixed; } .new-repository-group-visible { display: block; } .new-repository-group-left-bar { position: relative; float: left; width: 6px; background-image: url("../images/new-repository-left-repeat.png"); background-repeat: repeat-y; height: 54px; } .new-repository-group-stencil:last-child .new-repository-group-left-bar { height: 46px; } .new-repository-group-left-bar-bottom-gradient { width: 6px; background-image: url("../images/new-repository-group-bg.png"); background-position: 0px -15px; background-repeat: no-repeat; bottom: 1px; position: absolute; height: 39px; } .new-repository-group-left-bar-bottom-highlight { width: 6px; background-color: black; bottom: 0px; position: absolute; height: 1px; background-image: url("../images/new-repository-group-bg.png"); background-position: 0px -54px; background-repeat: repeat-y; } .new-repository-group-header { position: absolute; left: 0px; top: 0px; background-image: url("../images/new-repository-top-repeat.png"); background-position: 11px 0px; background-repeat: repeat-x; } .new-repository-group-header-label { font-size: 10px; color: white; text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0; -webkit-text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0; text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-weight: normal; text-align: left; display: inline; float:left; padding-top: 1px; padding-left: 5px; } /*.new-repository-group-header-label, x:-moz-any-link, x:default { padding-top: 3px; }*/ .new-repository-group-header-left-highlight { display:inline-block; float: left; background-image: url("../images/new-repository-group-bg.png"); background-position: 0px 0px; background-repeat: no-repeat; height: 15px; width: 11px; } .new-repository-group-header-right-highlight { display: inline-block; float:right; background-image: url("../images/new-repository-group-bg.png"); background-position: -13px 0px; background-repeat: no-repeat; height: 15px; width: 2px; } .new-repository-group-content { margin: 0px 0px 0px 11px; float: left; white-space:nowrap; position: relative; } .new-repository-group-entries { position: relative; text-align: left; } .new-repository-group-row { background-image: url("../images/new-repository-row-repeat.png"); background-repeat: repeat-x; height:29px; position: relative; cursor: move; } .new-repository-group-row:hover div { background-color: rgba(0, 157, 0, 0.2); } .new-repository-group-row:last-child { background-image: url("../images/new-repository-row-last-repeat.png"); border-bottom: 1px solid #B5B8C1; } .new-repository-group-row-lefthighlight { background-image: url("../images/new-repository-group-bg.png"); background-position: -6px -15px; background-repeat: no-repeat; height: 29px; width: 1px; position: absolute; left: 0px; } .new-repository-group-row-righthighlight { background-image: url("../images/new-repository-group-bg.png"); background-position: -8px -15px; background-repeat: no-repeat; height: 29px; width: 1px; position: absolute; right: 0px; top: 0px; } .new-repository-group-row-entry { padding: 5px 15px 5px 5px; } .new-repository-group-row-entry > img { vertical-align: middle; margin: 0px 5px; } #pwave-schlaumeier { position: fixed; float: right; z-index; 4500; background-color: #ffc; color: #000; text-align: center; border: 1px solid gray; font-family: 'Lucida Grande', 'Tahoma', sans-serif; font-size: 8pt; overflow: hidden; padding: 3px 2px 2px 2px; display: none; vertical-align: middle; top: 0px; right: 20px; width: 229px; height: 16px; } .paint-canvas-container { background-color: rgba(255,255,255,0.4); position: absolute; top: 0px; left: 0px; float: left; z-index: 4000; display: "none"; } .paint-canvas-container-active { cursor: crosshair; } .paint-canvas { position: absolute; top: 0px; left: 0px; float: left; } #paint-toolbar { position: fixed; width: 54px; top: 40px; background-color:transparent; z-index: 9500; } .paint-toolbar-button { background-image: url("../images/repository-groupstencil-bg.png"); background-color:transparent; background-repeat: no-repeat; background-position: 0px -53px; border: 0px; cursor: pointer; } .paint-toolbar-button:first-child { background-position: 0px 0px; } .paint-toolbar-button:last-child { background-position: 0px -106px; } .paint-toolbar-button-pressed { background-position: -55px -53px; } .paint-toolbar-button-pressed:first-child { background-position: -55px -0px; } .paint-toolbar-button-pressed:last-child { background-position: -55px -106px; } .paint-toolbar-button > div { height: 53px; width: 54px; background-repeat: no-repeat; background-position: center center; } .paint-toolbar-button:first-child > div { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; } .paint-toolbar-button:last-child > div { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; } .paint-toolbar-button:hover > div { background-color: rgba(0, 157, 0, 0.2); } .paint-toolbar-button-pressed > div { background-color:transparent; } .pw-toolbar-button { background: url(../images/toolbar-sprite.png) no-repeat top left !important; } .pw-toolbar-actual-size { background-position: 0 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-actual-size { background-position: -20px 0 !important; width: 15px; height: 15px; } .pw-toolbar-add-docker { background-position: -40px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-add-docker { background-position: -60px 0 !important; width: 15px; height: 15px; } .pw-toolbar-copy { background-position: -80px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-copy { background-position: -100px 0 !important; width: 15px; height: 15px; } .pw-toolbar-cut { background-position: -120px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-cut { background-position: -140px 0 !important; width: 15px; height: 15px; } .pw-toolbar-delete { background-position: -160px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-delete { background-position: -180px 0 !important; width: 15px; height: 15px; } .pw-toolbar-fit-screen { background-position: -200px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-fit-screen { background-position: -220px 0 !important; width: 15px; height: 15px; } .pw-toolbar-paint { background-position: -240px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-paint { background-position: -260px 0 !important; width: 15px; height: 15px; } .pw-toolbar-paste { background-position: -280px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-paste { background-position: -300px 0 !important; width: 15px; height: 15px; } .pw-toolbar-processwave { background-position: -320px 0 !important; width: 107px; height: 16px; } .pw-toolbar-redo { background-position: -432px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-redo { background-position: -452px 0 !important; width: 15px; height: 15px; } .pw-toolbar-remove-docker { background-position: -472px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-remove-docker { background-position: -492px 0 !important; width: 15px; height: 15px; } .pw-toolbar-undo { background-position: -512px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-undo { background-position: -532px 0 !important; width: 15px; height: 15px; } .pw-toolbar-zoom-in { background-position: -552px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-zoom-in { background-position: -572px 0 !important; width: 15px; height: 15px; } .pw-toolbar-zoom-out { background-position: -592px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-zoom-out { background-position: -612px 0 !important; width: 15px; height: 15px; } .pw-toolbar-export { background-position: -632px 0 !important; width: 15px; height: 15px; } .x-item-disabled .pw-toolbar-export { background-position: -652px 0 !important; width: 15px; height: 15px; } .x-btn-center { background: transparent; } .x-toolbar { z-index: 10000; position:fixed; top:0px; left:0px; height: 29px; padding: 0px 7px 0px 0px; background-image: url(../images/toolbar-bg.png); border-bottom: 1px solid #96989e; border-right: 1px solid #96989e; } .x-toolbar > table { padding: 5px 0px 0px 130px; background-image: url(../images/processwave.png); background-position: 10px 6px; background-repeat: no-repeat; } .x-btn-over { background-image: none !important; } .x-btn { font-size: 0px !important; } .x-grid3-header { /* Hide empty header in the property tab */ display: none; } /* * Removes the ugly dashed outline from all buttons in Firefox */ button::-moz-focus-inner { border: 0; } .x-grid-group-hd { padding-top: 2px; border-bottom: 2px solid #D7D7D7; } .x-grid-group-hd div { color: #606060; text-align: left; font-size: 0.7em; font-weight: normal; font-family: 'Lucida Grande', 'Tahoma', sans-serif; } .x-panel-header { display: none; }
08to09-processwave
oryx/editor/css/theme_norm.css
CSS
mit
29,522
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.DomHelper = function(){ var tempTableEl = null; var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i; var tableRe = /^table|tbody|tr|td$/i; var createHtml = function(o){ if(typeof o == 'string'){ return o; } var b = ""; if (Ext.isArray(o)) { for (var i = 0, l = o.length; i < l; i++) { b += createHtml(o[i]); } return b; } if(!o.tag){ o.tag = "div"; } b += "<" + o.tag; for(var attr in o){ if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue; if(attr == "style"){ var s = o["style"]; if(typeof s == "function"){ s = s.call(); } if(typeof s == "string"){ b += ' style="' + s + '"'; }else if(typeof s == "object"){ b += ' style="'; for(var key in s){ if(typeof s[key] != "function"){ b += key + ":" + s[key] + ";"; } } b += '"'; } }else{ if(attr == "cls"){ b += ' class="' + o["cls"] + '"'; }else if(attr == "htmlFor"){ b += ' for="' + o["htmlFor"] + '"'; }else{ b += " " + attr + '="' + o[attr] + '"'; } } } if(emptyTags.test(o.tag)){ b += "/>"; }else{ b += ">"; var cn = o.children || o.cn; if(cn){ b += createHtml(cn); } else if(o.html){ b += o.html; } b += "</" + o.tag + ">"; } return b; }; var createDom = function(o, parentNode){ var el; if (Ext.isArray(o)) { el = document.createDocumentFragment(); for(var i = 0, l = o.length; i < l; i++) { createDom(o[i], el); } } else if (typeof o == "string)") { el = document.createTextNode(o); } else { el = document.createElement(o.tag||'div'); var useSet = !!el.setAttribute; for(var attr in o){ if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue; if(attr=="cls"){ el.className = o["cls"]; }else{ if(useSet) el.setAttribute(attr, o[attr]); else el[attr] = o[attr]; } } Ext.DomHelper.applyStyles(el, o.style); var cn = o.children || o.cn; if(cn){ createDom(cn, el); } else if(o.html){ el.innerHTML = o.html; } } if(parentNode){ parentNode.appendChild(el); } return el; }; var ieTable = function(depth, s, h, e){ tempTableEl.innerHTML = [s, h, e].join(''); var i = -1, el = tempTableEl; while(++i < depth){ el = el.firstChild; } return el; }; var ts = '<table>', te = '</table>', tbs = ts+'<tbody>', tbe = '</tbody>'+te, trs = tbs + '<tr>', tre = '</tr>'+tbe; var insertIntoTable = function(tag, where, el, html){ if(!tempTableEl){ tempTableEl = document.createElement('div'); } var node; var before = null; if(tag == 'td'){ if(where == 'afterbegin' || where == 'beforeend'){ return; } if(where == 'beforebegin'){ before = el; el = el.parentNode; } else{ before = el.nextSibling; el = el.parentNode; } node = ieTable(4, trs, html, tre); } else if(tag == 'tr'){ if(where == 'beforebegin'){ before = el; el = el.parentNode; node = ieTable(3, tbs, html, tbe); } else if(where == 'afterend'){ before = el.nextSibling; el = el.parentNode; node = ieTable(3, tbs, html, tbe); } else{ if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(4, trs, html, tre); } } else if(tag == 'tbody'){ if(where == 'beforebegin'){ before = el; el = el.parentNode; node = ieTable(2, ts, html, te); } else if(where == 'afterend'){ before = el.nextSibling; el = el.parentNode; node = ieTable(2, ts, html, te); } else{ if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(3, tbs, html, tbe); } } else{ if(where == 'beforebegin' || where == 'afterend'){ return; } if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(2, ts, html, te); } el.insertBefore(node, before); return node; }; return { useDom : false, markup : function(o){ return createHtml(o); }, applyStyles : function(el, styles){ if(styles){ el = Ext.fly(el); if(typeof styles == "string"){ var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi; var matches; while ((matches = re.exec(styles)) != null){ el.setStyle(matches[1], matches[2]); } }else if (typeof styles == "object"){ for (var style in styles){ el.setStyle(style, styles[style]); } }else if (typeof styles == "function"){ Ext.DomHelper.applyStyles(el, styles.call()); } } }, insertHtml : function(where, el, html){ where = where.toLowerCase(); if(el.insertAdjacentHTML){ if(tableRe.test(el.tagName)){ var rs; if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){ return rs; } } switch(where){ case "beforebegin": el.insertAdjacentHTML('BeforeBegin', html); return el.previousSibling; case "afterbegin": el.insertAdjacentHTML('AfterBegin', html); return el.firstChild; case "beforeend": el.insertAdjacentHTML('BeforeEnd', html); return el.lastChild; case "afterend": el.insertAdjacentHTML('AfterEnd', html); return el.nextSibling; } throw 'Illegal insertion point -> "' + where + '"'; } var range = el.ownerDocument.createRange(); var frag; switch(where){ case "beforebegin": range.setStartBefore(el); frag = range.createContextualFragment(html); el.parentNode.insertBefore(frag, el); return el.previousSibling; case "afterbegin": if(el.firstChild){ range.setStartBefore(el.firstChild); frag = range.createContextualFragment(html); el.insertBefore(frag, el.firstChild); return el.firstChild; }else{ el.innerHTML = html; return el.firstChild; } case "beforeend": if(el.lastChild){ range.setStartAfter(el.lastChild); frag = range.createContextualFragment(html); el.appendChild(frag); return el.lastChild; }else{ el.innerHTML = html; return el.lastChild; } case "afterend": range.setStartAfter(el); frag = range.createContextualFragment(html); el.parentNode.insertBefore(frag, el.nextSibling); return el.nextSibling; } throw 'Illegal insertion point -> "' + where + '"'; }, insertBefore : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "beforeBegin"); }, insertAfter : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling"); }, insertFirst : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "afterBegin", "firstChild"); }, doInsert : function(el, o, returnElement, pos, sibling){ el = Ext.getDom(el); var newNode; if(this.useDom){ newNode = createDom(o, null); (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el); }else{ var html = createHtml(o); newNode = this.insertHtml(pos, el, html); } return returnElement ? Ext.get(newNode, true) : newNode; }, append : function(el, o, returnElement){ el = Ext.getDom(el); var newNode; if(this.useDom){ newNode = createDom(o, null); el.appendChild(newNode); }else{ var html = createHtml(o); newNode = this.insertHtml("beforeEnd", el, html); } return returnElement ? Ext.get(newNode, true) : newNode; }, overwrite : function(el, o, returnElement){ el = Ext.getDom(el); el.innerHTML = createHtml(o); return returnElement ? Ext.get(el.firstChild, true) : el.firstChild; }, createTemplate : function(o){ var html = createHtml(o); return new Ext.Template(html); } }; }(); Ext.Template = function(html){ var a = arguments; if(Ext.isArray(html)){ html = html.join(""); }else if(a.length > 1){ var buf = []; for(var i = 0, len = a.length; i < len; i++){ if(typeof a[i] == 'object'){ Ext.apply(this, a[i]); }else{ buf[buf.length] = a[i]; } } html = buf.join(''); } this.html = html; if(this.compiled){ this.compile(); } }; Ext.Template.prototype = { applyTemplate : function(values){ if(this.compiled){ return this.compiled(values); } var useF = this.disableFormats !== true; var fm = Ext.util.Format, tpl = this; var fn = function(m, name, format, args){ if(format && useF){ if(format.substr(0, 5) == "this."){ return tpl.call(format.substr(5), values[name], values); }else{ if(args){ var re = /^\s*['"](.*)["']\s*$/; args = args.split(','); for(var i = 0, len = args.length; i < len; i++){ args[i] = args[i].replace(re, "$1"); } args = [values[name]].concat(args); }else{ args = [values[name]]; } return fm[format].apply(fm, args); } }else{ return values[name] !== undefined ? values[name] : ""; } }; return this.html.replace(this.re, fn); }, set : function(html, compile){ this.html = html; this.compiled = null; if(compile){ this.compile(); } return this; }, disableFormats : false, re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g, compile : function(){ var fm = Ext.util.Format; var useF = this.disableFormats !== true; var sep = Ext.isGecko ? "+" : ","; var fn = function(m, name, format, args){ if(format && useF){ args = args ? ',' + args : ""; if(format.substr(0, 5) != "this."){ format = "fm." + format + '('; }else{ format = 'this.call("'+ format.substr(5) + '", '; args = ", values"; } }else{ args= ''; format = "(values['" + name + "'] == undefined ? '' : "; } return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'"; }; var body; if(Ext.isGecko){ body = "this.compiled = function(values){ return '" + this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) + "';};"; }else{ body = ["this.compiled = function(values){ return ['"]; body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn)); body.push("'].join('');};"); body = body.join(''); } eval(body); return this; }, call : function(fnName, value, allValues){ return this[fnName](value, allValues); }, insertFirst: function(el, values, returnElement){ return this.doInsert('afterBegin', el, values, returnElement); }, insertBefore: function(el, values, returnElement){ return this.doInsert('beforeBegin', el, values, returnElement); }, insertAfter : function(el, values, returnElement){ return this.doInsert('afterEnd', el, values, returnElement); }, append : function(el, values, returnElement){ return this.doInsert('beforeEnd', el, values, returnElement); }, doInsert : function(where, el, values, returnEl){ el = Ext.getDom(el); var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values)); return returnEl ? Ext.get(newNode, true) : newNode; }, overwrite : function(el, values, returnElement){ el = Ext.getDom(el); el.innerHTML = this.applyTemplate(values); return returnElement ? Ext.get(el.firstChild, true) : el.firstChild; } }; Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; Ext.DomHelper.Template = Ext.Template; Ext.Template.from = function(el, config){ el = Ext.getDom(el); return new Ext.Template(el.value || el.innerHTML, config || ''); }; Ext.DomQuery = function(){ var cache = {}, simpleCache = {}, valueCache = {}; var nonSpace = /\S/; var trimRe = /^\s+|\s+$/g; var tplRe = /\{(\d+)\}/g; var modeRe = /^(\s?[\/>+~]\s?|\s|$)/; var tagTokenRe = /^(#)?([\w-\*]+)/; var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/; function child(p, index){ var i = 0; var n = p.firstChild; while(n){ if(n.nodeType == 1){ if(++i == index){ return n; } } n = n.nextSibling; } return null; }; function next(n){ while((n = n.nextSibling) && n.nodeType != 1); return n; }; function prev(n){ while((n = n.previousSibling) && n.nodeType != 1); return n; }; function children(d){ var n = d.firstChild, ni = -1; while(n){ var nx = n.nextSibling; if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ d.removeChild(n); }else{ n.nodeIndex = ++ni; } n = nx; } return this; }; function byClassName(c, a, v){ if(!v){ return c; } var r = [], ri = -1, cn; for(var i = 0, ci; ci = c[i]; i++){ if((' '+ci.className+' ').indexOf(v) != -1){ r[++ri] = ci; } } return r; }; function attrValue(n, attr){ if(!n.tagName && typeof n.length != "undefined"){ n = n[0]; } if(!n){ return null; } if(attr == "for"){ return n.htmlFor; } if(attr == "class" || attr == "className"){ return n.className; } return n.getAttribute(attr) || n[attr]; }; function getNodes(ns, mode, tagName){ var result = [], ri = -1, cs; if(!ns){ return result; } tagName = tagName || "*"; if(typeof ns.getElementsByTagName != "undefined"){ ns = [ns]; } if(!mode){ for(var i = 0, ni; ni = ns[i]; i++){ cs = ni.getElementsByTagName(tagName); for(var j = 0, ci; ci = cs[j]; j++){ result[++ri] = ci; } } }else if(mode == "/" || mode == ">"){ var utag = tagName.toUpperCase(); for(var i = 0, ni, cn; ni = ns[i]; i++){ cn = ni.children || ni.childNodes; for(var j = 0, cj; cj = cn[j]; j++){ if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){ result[++ri] = cj; } } } }else if(mode == "+"){ var utag = tagName.toUpperCase(); for(var i = 0, n; n = ns[i]; i++){ while((n = n.nextSibling) && n.nodeType != 1); if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){ result[++ri] = n; } } }else if(mode == "~"){ for(var i = 0, n; n = ns[i]; i++){ while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName))); if(n){ result[++ri] = n; } } } return result; }; function concat(a, b){ if(b.slice){ return a.concat(b); } for(var i = 0, l = b.length; i < l; i++){ a[a.length] = b[i]; } return a; } function byTag(cs, tagName){ if(cs.tagName || cs == document){ cs = [cs]; } if(!tagName){ return cs; } var r = [], ri = -1; tagName = tagName.toLowerCase(); for(var i = 0, ci; ci = cs[i]; i++){ if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ r[++ri] = ci; } } return r; }; function byId(cs, attr, id){ if(cs.tagName || cs == document){ cs = [cs]; } if(!id){ return cs; } var r = [], ri = -1; for(var i = 0,ci; ci = cs[i]; i++){ if(ci && ci.id == id){ r[++ri] = ci; return r; } } return r; }; function byAttribute(cs, attr, value, op, custom){ var r = [], ri = -1, st = custom=="{"; var f = Ext.DomQuery.operators[op]; for(var i = 0, ci; ci = cs[i]; i++){ var a; if(st){ a = Ext.DomQuery.getStyle(ci, attr); } else if(attr == "class" || attr == "className"){ a = ci.className; }else if(attr == "for"){ a = ci.htmlFor; }else if(attr == "href"){ a = ci.getAttribute("href", 2); }else{ a = ci.getAttribute(attr); } if((f && f(a, value)) || (!f && a)){ r[++ri] = ci; } } return r; }; function byPseudo(cs, name, value){ return Ext.DomQuery.pseudos[name](cs, value); }; var isIE = window.ActiveXObject ? true : false; eval("var batch = 30803;"); var key = 30803; function nodupIEXml(cs){ var d = ++key; cs[0].setAttribute("_nodup", d); var r = [cs[0]]; for(var i = 1, len = cs.length; i < len; i++){ var c = cs[i]; if(!c.getAttribute("_nodup") != d){ c.setAttribute("_nodup", d); r[r.length] = c; } } for(var i = 0, len = cs.length; i < len; i++){ cs[i].removeAttribute("_nodup"); } return r; } function nodup(cs){ if(!cs){ return []; } var len = cs.length, c, i, r = cs, cj, ri = -1; if(!len || typeof cs.nodeType != "undefined" || len == 1){ return cs; } if(isIE && typeof cs[0].selectSingleNode != "undefined"){ return nodupIEXml(cs); } var d = ++key; cs[0]._nodup = d; for(i = 1; c = cs[i]; i++){ if(c._nodup != d){ c._nodup = d; }else{ r = []; for(var j = 0; j < i; j++){ r[++ri] = cs[j]; } for(j = i+1; cj = cs[j]; j++){ if(cj._nodup != d){ cj._nodup = d; r[++ri] = cj; } } return r; } } return r; } function quickDiffIEXml(c1, c2){ var d = ++key; for(var i = 0, len = c1.length; i < len; i++){ c1[i].setAttribute("_qdiff", d); } var r = []; for(var i = 0, len = c2.length; i < len; i++){ if(c2[i].getAttribute("_qdiff") != d){ r[r.length] = c2[i]; } } for(var i = 0, len = c1.length; i < len; i++){ c1[i].removeAttribute("_qdiff"); } return r; } function quickDiff(c1, c2){ var len1 = c1.length; if(!len1){ return c2; } if(isIE && c1[0].selectSingleNode){ return quickDiffIEXml(c1, c2); } var d = ++key; for(var i = 0; i < len1; i++){ c1[i]._qdiff = d; } var r = []; for(var i = 0, len = c2.length; i < len; i++){ if(c2[i]._qdiff != d){ r[r.length] = c2[i]; } } return r; } function quickId(ns, mode, root, id){ if(ns == root){ var d = root.ownerDocument || root; return d.getElementById(id); } ns = getNodes(ns, mode, "*"); return byId(ns, null, id); } return { getStyle : function(el, name){ return Ext.fly(el).getStyle(name); }, compile : function(path, type){ type = type || "select"; var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"]; var q = path, mode, lq; var tk = Ext.DomQuery.matchers; var tklen = tk.length; var mm; var lmode = q.match(modeRe); if(lmode && lmode[1]){ fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";'; q = q.replace(lmode[1], ""); } while(path.substr(0, 1)=="/"){ path = path.substr(1); } while(q && lq != q){ lq = q; var tm = q.match(tagTokenRe); if(type == "select"){ if(tm){ if(tm[1] == "#"){ fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; }else{ fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; } q = q.replace(tm[0], ""); }else if(q.substr(0, 1) != '@'){ fn[fn.length] = 'n = getNodes(n, mode, "*");'; } }else{ if(tm){ if(tm[1] == "#"){ fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; }else{ fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; } q = q.replace(tm[0], ""); } } while(!(mm = q.match(modeRe))){ var matched = false; for(var j = 0; j < tklen; j++){ var t = tk[j]; var m = q.match(t.re); if(m){ fn[fn.length] = t.select.replace(tplRe, function(x, i){ return m[i]; }); q = q.replace(m[0], ""); matched = true; break; } } if(!matched){ throw 'Error parsing selector, parsing failed at "' + q + '"'; } } if(mm[1]){ fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";'; q = q.replace(mm[1], ""); } } fn[fn.length] = "return nodup(n);\n}"; eval(fn.join("")); return f; }, select : function(path, root, type){ if(!root || root == document){ root = document; } if(typeof root == "string"){ root = document.getElementById(root); } var paths = path.split(","); var results = []; for(var i = 0, len = paths.length; i < len; i++){ var p = paths[i].replace(trimRe, ""); if(!cache[p]){ cache[p] = Ext.DomQuery.compile(p); if(!cache[p]){ throw p + " is not a valid selector"; } } var result = cache[p](root); if(result && result != document){ results = results.concat(result); } } if(paths.length > 1){ return nodup(results); } return results; }, selectNode : function(path, root){ return Ext.DomQuery.select(path, root)[0]; }, selectValue : function(path, root, defaultValue){ path = path.replace(trimRe, ""); if(!valueCache[path]){ valueCache[path] = Ext.DomQuery.compile(path, "select"); } var n = valueCache[path](root); n = n[0] ? n[0] : n; var v = (n && n.firstChild ? n.firstChild.nodeValue : null); return ((v === null||v === undefined||v==='') ? defaultValue : v); }, selectNumber : function(path, root, defaultValue){ var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0); return parseFloat(v); }, is : function(el, ss){ if(typeof el == "string"){ el = document.getElementById(el); } var isArray = Ext.isArray(el); var result = Ext.DomQuery.filter(isArray ? el : [el], ss); return isArray ? (result.length == el.length) : (result.length > 0); }, filter : function(els, ss, nonMatches){ ss = ss.replace(trimRe, ""); if(!simpleCache[ss]){ simpleCache[ss] = Ext.DomQuery.compile(ss, "simple"); } var result = simpleCache[ss](els); return nonMatches ? quickDiff(result, els) : result; }, matchers : [{ re: /^\.([\w-]+)/, select: 'n = byClassName(n, null, " {1} ");' }, { re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/, select: 'n = byPseudo(n, "{1}", "{2}");' },{ re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/, select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");' }, { re: /^#([\w-]+)/, select: 'n = byId(n, null, "{1}");' },{ re: /^@([\w-]+)/, select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};' } ], operators : { "=" : function(a, v){ return a == v; }, "!=" : function(a, v){ return a != v; }, "^=" : function(a, v){ return a && a.substr(0, v.length) == v; }, "$=" : function(a, v){ return a && a.substr(a.length-v.length) == v; }, "*=" : function(a, v){ return a && a.indexOf(v) !== -1; }, "%=" : function(a, v){ return (a % v) == 0; }, "|=" : function(a, v){ return a && (a == v || a.substr(0, v.length+1) == v+'-'); }, "~=" : function(a, v){ return a && (' '+a+' ').indexOf(' '+v+' ') != -1; } }, pseudos : { "first-child" : function(c){ var r = [], ri = -1, n; for(var i = 0, ci; ci = n = c[i]; i++){ while((n = n.previousSibling) && n.nodeType != 1); if(!n){ r[++ri] = ci; } } return r; }, "last-child" : function(c){ var r = [], ri = -1, n; for(var i = 0, ci; ci = n = c[i]; i++){ while((n = n.nextSibling) && n.nodeType != 1); if(!n){ r[++ri] = ci; } } return r; }, "nth-child" : function(c, a) { var r = [], ri = -1; var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a); var f = (m[1] || 1) - 0, l = m[2] - 0; for(var i = 0, n; n = c[i]; i++){ var pn = n.parentNode; if (batch != pn._batch) { var j = 0; for(var cn = pn.firstChild; cn; cn = cn.nextSibling){ if(cn.nodeType == 1){ cn.nodeIndex = ++j; } } pn._batch = batch; } if (f == 1) { if (l == 0 || n.nodeIndex == l){ r[++ri] = n; } } else if ((n.nodeIndex + l) % f == 0){ r[++ri] = n; } } return r; }, "only-child" : function(c){ var r = [], ri = -1;; for(var i = 0, ci; ci = c[i]; i++){ if(!prev(ci) && !next(ci)){ r[++ri] = ci; } } return r; }, "empty" : function(c){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var cns = ci.childNodes, j = 0, cn, empty = true; while(cn = cns[j]){ ++j; if(cn.nodeType == 1 || cn.nodeType == 3){ empty = false; break; } } if(empty){ r[++ri] = ci; } } return r; }, "contains" : function(c, v){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if((ci.textContent||ci.innerText||'').indexOf(v) != -1){ r[++ri] = ci; } } return r; }, "nodeValue" : function(c, v){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(ci.firstChild && ci.firstChild.nodeValue == v){ r[++ri] = ci; } } return r; }, "checked" : function(c){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(ci.checked == true){ r[++ri] = ci; } } return r; }, "not" : function(c, ss){ return Ext.DomQuery.filter(c, ss, true); }, "any" : function(c, selectors){ var ss = selectors.split('|'); var r = [], ri = -1, s; for(var i = 0, ci; ci = c[i]; i++){ for(var j = 0; s = ss[j]; j++){ if(Ext.DomQuery.is(ci, s)){ r[++ri] = ci; break; } } } return r; }, "odd" : function(c){ return this["nth-child"](c, "odd"); }, "even" : function(c){ return this["nth-child"](c, "even"); }, "nth" : function(c, a){ return c[a-1] || []; }, "first" : function(c){ return c[0] || []; }, "last" : function(c){ return c[c.length-1] || []; }, "has" : function(c, ss){ var s = Ext.DomQuery.select; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(s(ss, ci).length > 0){ r[++ri] = ci; } } return r; }, "next" : function(c, ss){ var is = Ext.DomQuery.is; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var n = next(ci); if(n && is(n, ss)){ r[++ri] = ci; } } return r; }, "prev" : function(c, ss){ var is = Ext.DomQuery.is; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var n = prev(ci); if(n && is(n, ss)){ r[++ri] = ci; } } return r; } } }; }(); Ext.query = Ext.DomQuery.select; Ext.util.Observable = function(){ if(this.listeners){ this.on(this.listeners); delete this.listeners; } }; Ext.util.Observable.prototype = { fireEvent : function(){ if(this.eventsSuspended !== true){ var ce = this.events[arguments[0].toLowerCase()]; if(typeof ce == "object"){ return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1)); } } return true; }, filterOptRe : /^(?:scope|delay|buffer|single)$/, addListener : function(eventName, fn, scope, o){ if(typeof eventName == "object"){ o = eventName; for(var e in o){ if(this.filterOptRe.test(e)){ continue; } if(typeof o[e] == "function"){ this.addListener(e, o[e], o.scope, o); }else{ this.addListener(e, o[e].fn, o[e].scope, o[e]); } } return; } o = (!o || typeof o == "boolean") ? {} : o; eventName = eventName.toLowerCase(); var ce = this.events[eventName] || true; if(typeof ce == "boolean"){ ce = new Ext.util.Event(this, eventName); this.events[eventName] = ce; } ce.addListener(fn, scope, o); }, removeListener : function(eventName, fn, scope){ var ce = this.events[eventName.toLowerCase()]; if(typeof ce == "object"){ ce.removeListener(fn, scope); } }, purgeListeners : function(){ for(var evt in this.events){ if(typeof this.events[evt] == "object"){ this.events[evt].clearListeners(); } } }, relayEvents : function(o, events){ var createHandler = function(ename){ return function(){ return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0))); }; }; for(var i = 0, len = events.length; i < len; i++){ var ename = events[i]; if(!this.events[ename]){ this.events[ename] = true; }; o.on(ename, createHandler(ename), this); } }, addEvents : function(o){ if(!this.events){ this.events = {}; } if(typeof o == 'string'){ for(var i = 0, a = arguments, v; v = a[i]; i++){ if(!this.events[a[i]]){ o[a[i]] = true; } } }else{ Ext.applyIf(this.events, o); } }, hasListener : function(eventName){ var e = this.events[eventName]; return typeof e == "object" && e.listeners.length > 0; }, suspendEvents : function(){ this.eventsSuspended = true; }, resumeEvents : function(){ this.eventsSuspended = false; }, getMethodEvent : function(method){ if(!this.methodEvents){ this.methodEvents = {}; } var e = this.methodEvents[method]; if(!e){ e = {}; this.methodEvents[method] = e; e.originalFn = this[method]; e.methodName = method; e.before = []; e.after = []; var returnValue, v, cancel; var obj = this; var makeCall = function(fn, scope, args){ if((v = fn.apply(scope || obj, args)) !== undefined){ if(typeof v === 'object'){ if(v.returnValue !== undefined){ returnValue = v.returnValue; }else{ returnValue = v; } if(v.cancel === true){ cancel = true; } }else if(v === false){ cancel = true; }else { returnValue = v; } } } this[method] = function(){ returnValue = v = undefined; cancel = false; var args = Array.prototype.slice.call(arguments, 0); for(var i = 0, len = e.before.length; i < len; i++){ makeCall(e.before[i].fn, e.before[i].scope, args); if(cancel){ return returnValue; } } if((v = e.originalFn.apply(obj, args)) !== undefined){ returnValue = v; } for(var i = 0, len = e.after.length; i < len; i++){ makeCall(e.after[i].fn, e.after[i].scope, args); if(cancel){ return returnValue; } } return returnValue; }; } return e; }, beforeMethod : function(method, fn, scope){ var e = this.getMethodEvent(method); e.before.push({fn: fn, scope: scope}); }, afterMethod : function(method, fn, scope){ var e = this.getMethodEvent(method); e.after.push({fn: fn, scope: scope}); }, removeMethodListener : function(method, fn, scope){ var e = this.getMethodEvent(method); for(var i = 0, len = e.before.length; i < len; i++){ if(e.before[i].fn == fn && e.before[i].scope == scope){ e.before.splice(i, 1); return; } } for(var i = 0, len = e.after.length; i < len; i++){ if(e.after[i].fn == fn && e.after[i].scope == scope){ e.after.splice(i, 1); return; } } } }; Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener; Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener; Ext.util.Observable.capture = function(o, fn, scope){ o.fireEvent = o.fireEvent.createInterceptor(fn, scope); }; Ext.util.Observable.releaseCapture = function(o){ o.fireEvent = Ext.util.Observable.prototype.fireEvent; }; (function(){ var createBuffered = function(h, o, scope){ var task = new Ext.util.DelayedTask(); return function(){ task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0)); }; }; var createSingle = function(h, e, fn, scope){ return function(){ e.removeListener(fn, scope); return h.apply(scope, arguments); }; }; var createDelayed = function(h, o, scope){ return function(){ var args = Array.prototype.slice.call(arguments, 0); setTimeout(function(){ h.apply(scope, args); }, o.delay || 10); }; }; Ext.util.Event = function(obj, name){ this.name = name; this.obj = obj; this.listeners = []; }; Ext.util.Event.prototype = { addListener : function(fn, scope, options){ scope = scope || this.obj; if(!this.isListening(fn, scope)){ var l = this.createListener(fn, scope, options); if(!this.firing){ this.listeners.push(l); }else{ this.listeners = this.listeners.slice(0); this.listeners.push(l); } } }, createListener : function(fn, scope, o){ o = o || {}; scope = scope || this.obj; var l = {fn: fn, scope: scope, options: o}; var h = fn; if(o.delay){ h = createDelayed(h, o, scope); } if(o.single){ h = createSingle(h, this, fn, scope); } if(o.buffer){ h = createBuffered(h, o, scope); } l.fireFn = h; return l; }, findListener : function(fn, scope){ scope = scope || this.obj; var ls = this.listeners; for(var i = 0, len = ls.length; i < len; i++){ var l = ls[i]; if(l.fn == fn && l.scope == scope){ return i; } } return -1; }, isListening : function(fn, scope){ return this.findListener(fn, scope) != -1; }, removeListener : function(fn, scope){ var index; if((index = this.findListener(fn, scope)) != -1){ if(!this.firing){ this.listeners.splice(index, 1); }else{ this.listeners = this.listeners.slice(0); this.listeners.splice(index, 1); } return true; } return false; }, clearListeners : function(){ this.listeners = []; }, fire : function(){ var ls = this.listeners, scope, len = ls.length; if(len > 0){ this.firing = true; var args = Array.prototype.slice.call(arguments, 0); for(var i = 0; i < len; i++){ var l = ls[i]; if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){ this.firing = false; return false; } } this.firing = false; } return true; } }; })(); Ext.EventManager = function(){ var docReadyEvent, docReadyProcId, docReadyState = false; var resizeEvent, resizeTask, textEvent, textSize; var E = Ext.lib.Event; var D = Ext.lib.Dom; var fireDocReady = function(){ if(!docReadyState){ docReadyState = true; Ext.isReady = true; if(docReadyProcId){ clearInterval(docReadyProcId); } if(Ext.isGecko || Ext.isOpera) { document.removeEventListener("DOMContentLoaded", fireDocReady, false); } if(Ext.isIE){ var defer = document.getElementById("ie-deferred-loader"); if(defer){ defer.onreadystatechange = null; defer.parentNode.removeChild(defer); } } if(docReadyEvent){ docReadyEvent.fire(); docReadyEvent.clearListeners(); } } }; var initDocReady = function(){ docReadyEvent = new Ext.util.Event(); if(Ext.isGecko || Ext.isOpera) { document.addEventListener("DOMContentLoaded", fireDocReady, false); }else if(Ext.isIE){ document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>"); var defer = document.getElementById("ie-deferred-loader"); defer.onreadystatechange = function(){ if(this.readyState == "complete"){ fireDocReady(); } }; }else if(Ext.isSafari){ docReadyProcId = setInterval(function(){ var rs = document.readyState; if(rs == "complete") { fireDocReady(); } }, 10); } E.on(window, "load", fireDocReady); }; var createBuffered = function(h, o){ var task = new Ext.util.DelayedTask(h); return function(e){ e = new Ext.EventObjectImpl(e); task.delay(o.buffer, h, null, [e]); }; }; var createSingle = function(h, el, ename, fn){ return function(e){ Ext.EventManager.removeListener(el, ename, fn); h(e); }; }; var createDelayed = function(h, o){ return function(e){ e = new Ext.EventObjectImpl(e); setTimeout(function(){ h(e); }, o.delay || 10); }; }; var listen = function(element, ename, opt, fn, scope){ var o = (!opt || typeof opt == "boolean") ? {} : opt; fn = fn || o.fn; scope = scope || o.scope; var el = Ext.getDom(element); if(!el){ throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.'; } var h = function(e){ e = Ext.EventObject.setEvent(e); var t; if(o.delegate){ t = e.getTarget(o.delegate, el); if(!t){ return; } }else{ t = e.target; } if(o.stopEvent === true){ e.stopEvent(); } if(o.preventDefault === true){ e.preventDefault(); } if(o.stopPropagation === true){ e.stopPropagation(); } if(o.normalized === false){ e = e.browserEvent; } fn.call(scope || el, e, t, o); }; if(o.delay){ h = createDelayed(h, o); } if(o.single){ h = createSingle(h, el, ename, fn); } if(o.buffer){ h = createBuffered(h, o); } fn._handlers = fn._handlers || []; fn._handlers.push([Ext.id(el), ename, h]); E.on(el, ename, h); if(ename == "mousewheel" && el.addEventListener){ el.addEventListener("DOMMouseScroll", h, false); E.on(window, 'unload', function(){ el.removeEventListener("DOMMouseScroll", h, false); }); } if(ename == "mousedown" && el == document){ Ext.EventManager.stoppedMouseDownEvent.addListener(h); } return h; }; var stopListening = function(el, ename, fn){ var id = Ext.id(el), hds = fn._handlers, hd = fn; if(hds){ for(var i = 0, len = hds.length; i < len; i++){ var h = hds[i]; if(h[0] == id && h[1] == ename){ hd = h[2]; hds.splice(i, 1); break; } } } E.un(el, ename, hd); el = Ext.getDom(el); if(ename == "mousewheel" && el.addEventListener){ el.removeEventListener("DOMMouseScroll", hd, false); } if(ename == "mousedown" && el == document){ Ext.EventManager.stoppedMouseDownEvent.removeListener(hd); } }; var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/; var pub = { addListener : function(element, eventName, fn, scope, options){ if(typeof eventName == "object"){ var o = eventName; for(var e in o){ if(propRe.test(e)){ continue; } if(typeof o[e] == "function"){ listen(element, e, o, o[e], o.scope); }else{ listen(element, e, o[e]); } } return; } return listen(element, eventName, options, fn, scope); }, removeListener : function(element, eventName, fn){ return stopListening(element, eventName, fn); }, onDocumentReady : function(fn, scope, options){ if(docReadyState){ docReadyEvent.addListener(fn, scope, options); docReadyEvent.fire(); docReadyEvent.clearListeners(); return; } if(!docReadyEvent){ initDocReady(); } docReadyEvent.addListener(fn, scope, options); }, onWindowResize : function(fn, scope, options){ if(!resizeEvent){ resizeEvent = new Ext.util.Event(); resizeTask = new Ext.util.DelayedTask(function(){ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); }); E.on(window, "resize", this.fireWindowResize, this); } resizeEvent.addListener(fn, scope, options); }, fireWindowResize : function(){ if(resizeEvent){ if((Ext.isIE||Ext.isAir) && resizeTask){ resizeTask.delay(50); }else{ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); } } }, onTextResize : function(fn, scope, options){ if(!textEvent){ textEvent = new Ext.util.Event(); var textEl = new Ext.Element(document.createElement('div')); textEl.dom.className = 'x-text-resize'; textEl.dom.innerHTML = 'X'; textEl.appendTo(document.body); textSize = textEl.dom.offsetHeight; setInterval(function(){ if(textEl.dom.offsetHeight != textSize){ textEvent.fire(textSize, textSize = textEl.dom.offsetHeight); } }, this.textResizeInterval); } textEvent.addListener(fn, scope, options); }, removeResizeListener : function(fn, scope){ if(resizeEvent){ resizeEvent.removeListener(fn, scope); } }, fireResize : function(){ if(resizeEvent){ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); } }, ieDeferSrc : false, textResizeInterval : 50 }; pub.on = pub.addListener; pub.un = pub.removeListener; pub.stoppedMouseDownEvent = new Ext.util.Event(); return pub; }(); Ext.onReady = Ext.EventManager.onDocumentReady; Ext.onReady(function(){ var bd = Ext.getBody(); if(!bd){ return; } var cls = [ Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7') : Ext.isGecko ? "ext-gecko" : Ext.isOpera ? "ext-opera" : Ext.isSafari ? "ext-safari" : ""]; if(Ext.isMac){ cls.push("ext-mac"); } if(Ext.isLinux){ cls.push("ext-linux"); } if(Ext.isBorderBox){ cls.push('ext-border-box'); } if(Ext.isStrict){ var p = bd.dom.parentNode; if(p){ p.className += ' ext-strict'; } } bd.addClass(cls.join(' ')); }); Ext.EventObject = function(){ var E = Ext.lib.Event; var safariKeys = { 63234 : 37, 63235 : 39, 63232 : 38, 63233 : 40, 63276 : 33, 63277 : 34, 63272 : 46, 63273 : 36, 63275 : 35 }; var btnMap = Ext.isIE ? {1:0,4:1,2:2} : (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2}); Ext.EventObjectImpl = function(e){ if(e){ this.setEvent(e.browserEvent || e); } }; Ext.EventObjectImpl.prototype = { browserEvent : null, button : -1, shiftKey : false, ctrlKey : false, altKey : false, BACKSPACE : 8, TAB : 9, RETURN : 13, ENTER : 13, SHIFT : 16, CONTROL : 17, ESC : 27, SPACE : 32, PAGEUP : 33, PAGEDOWN : 34, END : 35, HOME : 36, LEFT : 37, UP : 38, RIGHT : 39, DOWN : 40, DELETE : 46, F5 : 116, setEvent : function(e){ if(e == this || (e && e.browserEvent)){ return e; } this.browserEvent = e; if(e){ this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1); if(e.type == 'click' && this.button == -1){ this.button = 0; } this.type = e.type; this.shiftKey = e.shiftKey; this.ctrlKey = e.ctrlKey || e.metaKey; this.altKey = e.altKey; this.keyCode = e.keyCode; this.charCode = e.charCode; this.target = E.getTarget(e); this.xy = E.getXY(e); }else{ this.button = -1; this.shiftKey = false; this.ctrlKey = false; this.altKey = false; this.keyCode = 0; this.charCode =0; this.target = null; this.xy = [0, 0]; } return this; }, stopEvent : function(){ if(this.browserEvent){ if(this.browserEvent.type == 'mousedown'){ Ext.EventManager.stoppedMouseDownEvent.fire(this); } E.stopEvent(this.browserEvent); } }, preventDefault : function(){ if(this.browserEvent){ E.preventDefault(this.browserEvent); } }, isNavKeyPress : function(){ var k = this.keyCode; k = Ext.isSafari ? (safariKeys[k] || k) : k; return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC; }, isSpecialKey : function(){ var k = this.keyCode; return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 || (k == 16) || (k == 17) || (k >= 18 && k <= 20) || (k >= 33 && k <= 35) || (k >= 36 && k <= 39) || (k >= 44 && k <= 45); }, stopPropagation : function(){ if(this.browserEvent){ if(this.browserEvent.type == 'mousedown'){ Ext.EventManager.stoppedMouseDownEvent.fire(this); } E.stopPropagation(this.browserEvent); } }, getCharCode : function(){ return this.charCode || this.keyCode; }, getKey : function(){ var k = this.keyCode || this.charCode; return Ext.isSafari ? (safariKeys[k] || k) : k; }, getPageX : function(){ return this.xy[0]; }, getPageY : function(){ return this.xy[1]; }, getTime : function(){ if(this.browserEvent){ return E.getTime(this.browserEvent); } return null; }, getXY : function(){ return this.xy; }, getTarget : function(selector, maxDepth, returnEl){ var t = Ext.get(this.target); return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target); }, getRelatedTarget : function(){ if(this.browserEvent){ return E.getRelatedTarget(this.browserEvent); } return null; }, getWheelDelta : function(){ var e = this.browserEvent; var delta = 0; if(e.wheelDelta){ delta = e.wheelDelta/120; }else if(e.detail){ delta = -e.detail/3; } return delta; }, hasModifier : function(){ return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false; }, within : function(el, related){ var t = this[related ? "getRelatedTarget" : "getTarget"](); return t && Ext.fly(el).contains(t); }, getPoint : function(){ return new Ext.lib.Point(this.xy[0], this.xy[1]); } }; return new Ext.EventObjectImpl(); }(); (function(){ var D = Ext.lib.Dom; var E = Ext.lib.Event; var A = Ext.lib.Anim; var propCache = {}; var camelRe = /(-[a-z])/gi; var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); }; var view = document.defaultView; Ext.Element = function(element, forceNew){ var dom = typeof element == "string" ? document.getElementById(element) : element; if(!dom){ return null; } var id = dom.id; if(forceNew !== true && id && Ext.Element.cache[id]){ return Ext.Element.cache[id]; } this.dom = dom; this.id = id || Ext.id(dom); }; var El = Ext.Element; El.prototype = { originalDisplay : "", visibilityMode : 1, defaultUnit : "px", setVisibilityMode : function(visMode){ this.visibilityMode = visMode; return this; }, enableDisplayMode : function(display){ this.setVisibilityMode(El.DISPLAY); if(typeof display != "undefined") this.originalDisplay = display; return this; }, findParent : function(simpleSelector, maxDepth, returnEl){ var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl; maxDepth = maxDepth || 50; if(typeof maxDepth != "number"){ stopEl = Ext.getDom(maxDepth); maxDepth = 10; } while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){ if(dq.is(p, simpleSelector)){ return returnEl ? Ext.get(p) : p; } depth++; p = p.parentNode; } return null; }, findParentNode : function(simpleSelector, maxDepth, returnEl){ var p = Ext.fly(this.dom.parentNode, '_internal'); return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null; }, up : function(simpleSelector, maxDepth){ return this.findParentNode(simpleSelector, maxDepth, true); }, is : function(simpleSelector){ return Ext.DomQuery.is(this.dom, simpleSelector); }, animate : function(args, duration, onComplete, easing, animType){ this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType); return this; }, anim : function(args, opt, animType, defaultDur, defaultEase, cb){ animType = animType || 'run'; opt = opt || {}; var anim = Ext.lib.Anim[animType]( this.dom, args, (opt.duration || defaultDur) || .35, (opt.easing || defaultEase) || 'easeOut', function(){ Ext.callback(cb, this); Ext.callback(opt.callback, opt.scope || this, [this, opt]); }, this ); opt.anim = anim; return anim; }, preanim : function(a, i){ return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]}); }, clean : function(forceReclean){ if(this.isCleaned && forceReclean !== true){ return this; } var ns = /\S/; var d = this.dom, n = d.firstChild, ni = -1; while(n){ var nx = n.nextSibling; if(n.nodeType == 3 && !ns.test(n.nodeValue)){ d.removeChild(n); }else{ n.nodeIndex = ++ni; } n = nx; } this.isCleaned = true; return this; }, scrollIntoView : function(container, hscroll){ var c = Ext.getDom(container) || Ext.getBody().dom; var el = this.dom; var o = this.getOffsetsTo(c), l = o[0] + c.scrollLeft, t = o[1] + c.scrollTop, b = t+el.offsetHeight, r = l+el.offsetWidth; var ch = c.clientHeight; var ct = parseInt(c.scrollTop, 10); var cl = parseInt(c.scrollLeft, 10); var cb = ct + ch; var cr = cl + c.clientWidth; if(el.offsetHeight > ch || t < ct){ c.scrollTop = t; }else if(b > cb){ c.scrollTop = b-ch; } c.scrollTop = c.scrollTop; if(hscroll !== false){ if(el.offsetWidth > c.clientWidth || l < cl){ c.scrollLeft = l; }else if(r > cr){ c.scrollLeft = r-c.clientWidth; } c.scrollLeft = c.scrollLeft; } return this; }, scrollChildIntoView : function(child, hscroll){ Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll); }, autoHeight : function(animate, duration, onComplete, easing){ var oldHeight = this.getHeight(); this.clip(); this.setHeight(1); setTimeout(function(){ var height = parseInt(this.dom.scrollHeight, 10); if(!animate){ this.setHeight(height); this.unclip(); if(typeof onComplete == "function"){ onComplete(); } }else{ this.setHeight(oldHeight); this.setHeight(height, animate, duration, function(){ this.unclip(); if(typeof onComplete == "function") onComplete(); }.createDelegate(this), easing); } }.createDelegate(this), 0); return this; }, contains : function(el){ if(!el){return false;} return D.isAncestor(this.dom, el.dom ? el.dom : el); }, isVisible : function(deep) { var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none"); if(deep !== true || !vis){ return vis; } var p = this.dom.parentNode; while(p && p.tagName.toLowerCase() != "body"){ if(!Ext.fly(p, '_isVisible').isVisible()){ return false; } p = p.parentNode; } return true; }, select : function(selector, unique){ return El.select(selector, unique, this.dom); }, query : function(selector, unique){ return Ext.DomQuery.select(selector, this.dom); }, child : function(selector, returnDom){ var n = Ext.DomQuery.selectNode(selector, this.dom); return returnDom ? n : Ext.get(n); }, down : function(selector, returnDom){ var n = Ext.DomQuery.selectNode(" > " + selector, this.dom); return returnDom ? n : Ext.get(n); }, initDD : function(group, config, overrides){ var dd = new Ext.dd.DD(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, initDDProxy : function(group, config, overrides){ var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, initDDTarget : function(group, config, overrides){ var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, setVisible : function(visible, animate){ if(!animate || !A){ if(this.visibilityMode == El.DISPLAY){ this.setDisplayed(visible); }else{ this.fixDisplay(); this.dom.style.visibility = visible ? "visible" : "hidden"; } }else{ var dom = this.dom; var visMode = this.visibilityMode; if(visible){ this.setOpacity(.01); this.setVisible(true); } this.anim({opacity: { to: (visible?1:0) }}, this.preanim(arguments, 1), null, .35, 'easeIn', function(){ if(!visible){ if(visMode == El.DISPLAY){ dom.style.display = "none"; }else{ dom.style.visibility = "hidden"; } Ext.get(dom).setOpacity(1); } }); } return this; }, isDisplayed : function() { return this.getStyle("display") != "none"; }, toggle : function(animate){ this.setVisible(!this.isVisible(), this.preanim(arguments, 0)); return this; }, setDisplayed : function(value) { if(typeof value == "boolean"){ value = value ? this.originalDisplay : "none"; } this.setStyle("display", value); return this; }, focus : function() { try{ this.dom.focus(); }catch(e){} return this; }, blur : function() { try{ this.dom.blur(); }catch(e){} return this; }, addClass : function(className){ if(Ext.isArray(className)){ for(var i = 0, len = className.length; i < len; i++) { this.addClass(className[i]); } }else{ if(className && !this.hasClass(className)){ this.dom.className = this.dom.className + " " + className; } } return this; }, radioClass : function(className){ var siblings = this.dom.parentNode.childNodes; for(var i = 0; i < siblings.length; i++) { var s = siblings[i]; if(s.nodeType == 1){ Ext.get(s).removeClass(className); } } this.addClass(className); return this; }, removeClass : function(className){ if(!className || !this.dom.className){ return this; } if(Ext.isArray(className)){ for(var i = 0, len = className.length; i < len; i++) { this.removeClass(className[i]); } }else{ if(this.hasClass(className)){ var re = this.classReCache[className]; if (!re) { re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g"); this.classReCache[className] = re; } this.dom.className = this.dom.className.replace(re, " "); } } return this; }, classReCache: {}, toggleClass : function(className){ if(this.hasClass(className)){ this.removeClass(className); }else{ this.addClass(className); } return this; }, hasClass : function(className){ return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1; }, replaceClass : function(oldClassName, newClassName){ this.removeClass(oldClassName); this.addClass(newClassName); return this; }, getStyles : function(){ var a = arguments, len = a.length, r = {}; for(var i = 0; i < len; i++){ r[a[i]] = this.getStyle(a[i]); } return r; }, getStyle : function(){ return view && view.getComputedStyle ? function(prop){ var el = this.dom, v, cs, camel; if(prop == 'float'){ prop = "cssFloat"; } if(v = el.style[prop]){ return v; } if(cs = view.getComputedStyle(el, "")){ if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } return cs[camel]; } return null; } : function(prop){ var el = this.dom, v, cs, camel; if(prop == 'opacity'){ if(typeof el.style.filter == 'string'){ var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i); if(m){ var fv = parseFloat(m[1]); if(!isNaN(fv)){ return fv ? fv / 100 : 0; } } } return 1; }else if(prop == 'float'){ prop = "styleFloat"; } if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } if(v = el.style[camel]){ return v; } if(cs = el.currentStyle){ return cs[camel]; } return null; }; }(), setStyle : function(prop, value){ if(typeof prop == "string"){ var camel; if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } if(camel == 'opacity') { this.setOpacity(value); }else{ this.dom.style[camel] = value; } }else{ for(var style in prop){ if(typeof prop[style] != "function"){ this.setStyle(style, prop[style]); } } } return this; }, applyStyles : function(style){ Ext.DomHelper.applyStyles(this.dom, style); return this; }, getX : function(){ return D.getX(this.dom); }, getY : function(){ return D.getY(this.dom); }, getXY : function(){ return D.getXY(this.dom); }, getOffsetsTo : function(el){ var o = this.getXY(); var e = Ext.fly(el, '_internal').getXY(); return [o[0]-e[0],o[1]-e[1]]; }, setX : function(x, animate){ if(!animate || !A){ D.setX(this.dom, x); }else{ this.setXY([x, this.getY()], this.preanim(arguments, 1)); } return this; }, setY : function(y, animate){ if(!animate || !A){ D.setY(this.dom, y); }else{ this.setXY([this.getX(), y], this.preanim(arguments, 1)); } return this; }, setLeft : function(left){ this.setStyle("left", this.addUnits(left)); return this; }, setTop : function(top){ this.setStyle("top", this.addUnits(top)); return this; }, setRight : function(right){ this.setStyle("right", this.addUnits(right)); return this; }, setBottom : function(bottom){ this.setStyle("bottom", this.addUnits(bottom)); return this; }, setXY : function(pos, animate){ if(!animate || !A){ D.setXY(this.dom, pos); }else{ this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion'); } return this; }, setLocation : function(x, y, animate){ this.setXY([x, y], this.preanim(arguments, 2)); return this; }, moveTo : function(x, y, animate){ this.setXY([x, y], this.preanim(arguments, 2)); return this; }, getRegion : function(){ return D.getRegion(this.dom); }, getHeight : function(contentHeight){ var h = this.dom.offsetHeight || 0; h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb"); return h < 0 ? 0 : h; }, getWidth : function(contentWidth){ var w = this.dom.offsetWidth || 0; w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr"); return w < 0 ? 0 : w; }, getComputedHeight : function(){ var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight); if(!h){ h = parseInt(this.getStyle('height'), 10) || 0; if(!this.isBorderBox()){ h += this.getFrameWidth('tb'); } } return h; }, getComputedWidth : function(){ var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth); if(!w){ w = parseInt(this.getStyle('width'), 10) || 0; if(!this.isBorderBox()){ w += this.getFrameWidth('lr'); } } return w; }, getSize : function(contentSize){ return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)}; }, getStyleSize : function(){ var w, h, d = this.dom, s = d.style; if(s.width && s.width != 'auto'){ w = parseInt(s.width, 10); if(Ext.isBorderBox){ w -= this.getFrameWidth('lr'); } } if(s.height && s.height != 'auto'){ h = parseInt(s.height, 10); if(Ext.isBorderBox){ h -= this.getFrameWidth('tb'); } } return {width: w || this.getWidth(true), height: h || this.getHeight(true)}; }, getViewSize : function(){ var d = this.dom, doc = document, aw = 0, ah = 0; if(d == doc || d == doc.body){ return {width : D.getViewWidth(), height: D.getViewHeight()}; }else{ return { width : d.clientWidth, height: d.clientHeight }; } }, getValue : function(asNumber){ return asNumber ? parseInt(this.dom.value, 10) : this.dom.value; }, adjustWidth : function(width){ if(typeof width == "number"){ if(this.autoBoxAdjust && !this.isBorderBox()){ width -= (this.getBorderWidth("lr") + this.getPadding("lr")); } if(width < 0){ width = 0; } } return width; }, adjustHeight : function(height){ if(typeof height == "number"){ if(this.autoBoxAdjust && !this.isBorderBox()){ height -= (this.getBorderWidth("tb") + this.getPadding("tb")); } if(height < 0){ height = 0; } } return height; }, setWidth : function(width, animate){ width = this.adjustWidth(width); if(!animate || !A){ this.dom.style.width = this.addUnits(width); }else{ this.anim({width: {to: width}}, this.preanim(arguments, 1)); } return this; }, setHeight : function(height, animate){ height = this.adjustHeight(height); if(!animate || !A){ this.dom.style.height = this.addUnits(height); }else{ this.anim({height: {to: height}}, this.preanim(arguments, 1)); } return this; }, setSize : function(width, height, animate){ if(typeof width == "object"){ height = width.height; width = width.width; } width = this.adjustWidth(width); height = this.adjustHeight(height); if(!animate || !A){ this.dom.style.width = this.addUnits(width); this.dom.style.height = this.addUnits(height); }else{ this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2)); } return this; }, setBounds : function(x, y, width, height, animate){ if(!animate || !A){ this.setSize(width, height); this.setLocation(x, y); }else{ width = this.adjustWidth(width); height = this.adjustHeight(height); this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}}, this.preanim(arguments, 4), 'motion'); } return this; }, setRegion : function(region, animate){ this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1)); return this; }, addListener : function(eventName, fn, scope, options){ Ext.EventManager.on(this.dom, eventName, fn, scope || this, options); }, removeListener : function(eventName, fn){ Ext.EventManager.removeListener(this.dom, eventName, fn); return this; }, removeAllListeners : function(){ E.purgeElement(this.dom); return this; }, relayEvent : function(eventName, observable){ this.on(eventName, function(e){ observable.fireEvent(eventName, e); }); }, setOpacity : function(opacity, animate){ if(!animate || !A){ var s = this.dom.style; if(Ext.isIE){ s.zoom = 1; s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") + (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")"); }else{ s.opacity = opacity; } }else{ this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn'); } return this; }, getLeft : function(local){ if(!local){ return this.getX(); }else{ return parseInt(this.getStyle("left"), 10) || 0; } }, getRight : function(local){ if(!local){ return this.getX() + this.getWidth(); }else{ return (this.getLeft(true) + this.getWidth()) || 0; } }, getTop : function(local) { if(!local){ return this.getY(); }else{ return parseInt(this.getStyle("top"), 10) || 0; } }, getBottom : function(local){ if(!local){ return this.getY() + this.getHeight(); }else{ return (this.getTop(true) + this.getHeight()) || 0; } }, position : function(pos, zIndex, x, y){ if(!pos){ if(this.getStyle('position') == 'static'){ this.setStyle('position', 'relative'); } }else{ this.setStyle("position", pos); } if(zIndex){ this.setStyle("z-index", zIndex); } if(x !== undefined && y !== undefined){ this.setXY([x, y]); }else if(x !== undefined){ this.setX(x); }else if(y !== undefined){ this.setY(y); } }, clearPositioning : function(value){ value = value ||''; this.setStyle({ "left": value, "right": value, "top": value, "bottom": value, "z-index": "", "position" : "static" }); return this; }, getPositioning : function(){ var l = this.getStyle("left"); var t = this.getStyle("top"); return { "position" : this.getStyle("position"), "left" : l, "right" : l ? "" : this.getStyle("right"), "top" : t, "bottom" : t ? "" : this.getStyle("bottom"), "z-index" : this.getStyle("z-index") }; }, getBorderWidth : function(side){ return this.addStyles(side, El.borders); }, getPadding : function(side){ return this.addStyles(side, El.paddings); }, setPositioning : function(pc){ this.applyStyles(pc); if(pc.right == "auto"){ this.dom.style.right = ""; } if(pc.bottom == "auto"){ this.dom.style.bottom = ""; } return this; }, fixDisplay : function(){ if(this.getStyle("display") == "none"){ this.setStyle("visibility", "hidden"); this.setStyle("display", this.originalDisplay); if(this.getStyle("display") == "none"){ this.setStyle("display", "block"); } } }, setOverflow : function(v){ if(v=='auto' && Ext.isMac && Ext.isGecko){ this.dom.style.overflow = 'hidden'; (function(){this.dom.style.overflow = 'auto';}).defer(1, this); }else{ this.dom.style.overflow = v; } }, setLeftTop : function(left, top){ this.dom.style.left = this.addUnits(left); this.dom.style.top = this.addUnits(top); return this; }, move : function(direction, distance, animate){ var xy = this.getXY(); direction = direction.toLowerCase(); switch(direction){ case "l": case "left": this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2)); break; case "r": case "right": this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2)); break; case "t": case "top": case "up": this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2)); break; case "b": case "bottom": case "down": this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2)); break; } return this; }, clip : function(){ if(!this.isClipped){ this.isClipped = true; this.originalClip = { "o": this.getStyle("overflow"), "x": this.getStyle("overflow-x"), "y": this.getStyle("overflow-y") }; this.setStyle("overflow", "hidden"); this.setStyle("overflow-x", "hidden"); this.setStyle("overflow-y", "hidden"); } return this; }, unclip : function(){ if(this.isClipped){ this.isClipped = false; var o = this.originalClip; if(o.o){this.setStyle("overflow", o.o);} if(o.x){this.setStyle("overflow-x", o.x);} if(o.y){this.setStyle("overflow-y", o.y);} } return this; }, getAnchorXY : function(anchor, local, s){ var w, h, vp = false; if(!s){ var d = this.dom; if(d == document.body || d == document){ vp = true; w = D.getViewWidth(); h = D.getViewHeight(); }else{ w = this.getWidth(); h = this.getHeight(); } }else{ w = s.width; h = s.height; } var x = 0, y = 0, r = Math.round; switch((anchor || "tl").toLowerCase()){ case "c": x = r(w*.5); y = r(h*.5); break; case "t": x = r(w*.5); y = 0; break; case "l": x = 0; y = r(h*.5); break; case "r": x = w; y = r(h*.5); break; case "b": x = r(w*.5); y = h; break; case "tl": x = 0; y = 0; break; case "bl": x = 0; y = h; break; case "br": x = w; y = h; break; case "tr": x = w; y = 0; break; } if(local === true){ return [x, y]; } if(vp){ var sc = this.getScroll(); return [x + sc.left, y + sc.top]; } var o = this.getXY(); return [x+o[0], y+o[1]]; }, getAlignToXY : function(el, p, o){ el = Ext.get(el); if(!el || !el.dom){ throw "Element.alignToXY with an element that doesn't exist"; } var d = this.dom; var c = false; var p1 = "", p2 = ""; o = o || [0,0]; if(!p){ p = "tl-bl"; }else if(p == "?"){ p = "tl-bl?"; }else if(p.indexOf("-") == -1){ p = "tl-" + p; } p = p.toLowerCase(); var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/); if(!m){ throw "Element.alignTo with an invalid alignment " + p; } p1 = m[1]; p2 = m[2]; c = !!m[3]; var a1 = this.getAnchorXY(p1, true); var a2 = el.getAnchorXY(p2, false); var x = a2[0] - a1[0] + o[0]; var y = a2[1] - a1[1] + o[1]; if(c){ var w = this.getWidth(), h = this.getHeight(), r = el.getRegion(); var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5; var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1); var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1); var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t")); var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r")); var doc = document; var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5; var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5; if((x+w) > dw + scrollX){ x = swapX ? r.left-w : dw+scrollX-w; } if(x < scrollX){ x = swapX ? r.right : scrollX; } if((y+h) > dh + scrollY){ y = swapY ? r.top-h : dh+scrollY-h; } if (y < scrollY){ y = swapY ? r.bottom : scrollY; } } return [x,y]; }, getConstrainToXY : function(){ var os = {top:0, left:0, bottom:0, right: 0}; return function(el, local, offsets, proposedXY){ el = Ext.get(el); offsets = offsets ? Ext.applyIf(offsets, os) : os; var vw, vh, vx = 0, vy = 0; if(el.dom == document.body || el.dom == document){ vw = Ext.lib.Dom.getViewWidth(); vh = Ext.lib.Dom.getViewHeight(); }else{ vw = el.dom.clientWidth; vh = el.dom.clientHeight; if(!local){ var vxy = el.getXY(); vx = vxy[0]; vy = vxy[1]; } } var s = el.getScroll(); vx += offsets.left + s.left; vy += offsets.top + s.top; vw -= offsets.right; vh -= offsets.bottom; var vr = vx+vw; var vb = vy+vh; var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]); var x = xy[0], y = xy[1]; var w = this.dom.offsetWidth, h = this.dom.offsetHeight; var moved = false; if((x + w) > vr){ x = vr - w; moved = true; } if((y + h) > vb){ y = vb - h; moved = true; } if(x < vx){ x = vx; moved = true; } if(y < vy){ y = vy; moved = true; } return moved ? [x, y] : false; }; }(), adjustForConstraints : function(xy, parent, offsets){ return this.getConstrainToXY(parent || document, false, offsets, xy) || xy; }, alignTo : function(element, position, offsets, animate){ var xy = this.getAlignToXY(element, position, offsets); this.setXY(xy, this.preanim(arguments, 3)); return this; }, anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){ var action = function(){ this.alignTo(el, alignment, offsets, animate); Ext.callback(callback, this); }; Ext.EventManager.onWindowResize(action, this); var tm = typeof monitorScroll; if(tm != 'undefined'){ Ext.EventManager.on(window, 'scroll', action, this, {buffer: tm == 'number' ? monitorScroll : 50}); } action.call(this); return this; }, clearOpacity : function(){ if (window.ActiveXObject) { if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){ this.dom.style.filter = ""; } } else { this.dom.style.opacity = ""; this.dom.style["-moz-opacity"] = ""; this.dom.style["-khtml-opacity"] = ""; } return this; }, hide : function(animate){ this.setVisible(false, this.preanim(arguments, 0)); return this; }, show : function(animate){ this.setVisible(true, this.preanim(arguments, 0)); return this; }, addUnits : function(size){ return Ext.Element.addUnits(size, this.defaultUnit); }, update : function(html, loadScripts, callback){ if(typeof html == "undefined"){ html = ""; } if(loadScripts !== true){ this.dom.innerHTML = html; if(typeof callback == "function"){ callback(); } return this; } var id = Ext.id(); var dom = this.dom; html += '<span id="' + id + '"></span>'; E.onAvailable(id, function(){ var hd = document.getElementsByTagName("head")[0]; var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig; var srcRe = /\ssrc=([\'\"])(.*?)\1/i; var typeRe = /\stype=([\'\"])(.*?)\1/i; var match; while(match = re.exec(html)){ var attrs = match[1]; var srcMatch = attrs ? attrs.match(srcRe) : false; if(srcMatch && srcMatch[2]){ var s = document.createElement("script"); s.src = srcMatch[2]; var typeMatch = attrs.match(typeRe); if(typeMatch && typeMatch[2]){ s.type = typeMatch[2]; } hd.appendChild(s); }else if(match[2] && match[2].length > 0){ if(window.execScript) { window.execScript(match[2]); } else { window.eval(match[2]); } } } var el = document.getElementById(id); if(el){Ext.removeNode(el);} if(typeof callback == "function"){ callback(); } }); dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, ""); return this; }, load : function(){ var um = this.getUpdater(); um.update.apply(um, arguments); return this; }, getUpdater : function(){ if(!this.updateManager){ this.updateManager = new Ext.Updater(this); } return this.updateManager; }, unselectable : function(){ this.dom.unselectable = "on"; this.swallowEvent("selectstart", true); this.applyStyles("-moz-user-select:none;-khtml-user-select:none;"); this.addClass("x-unselectable"); return this; }, getCenterXY : function(){ return this.getAlignToXY(document, 'c-c'); }, center : function(centerIn){ this.alignTo(centerIn || document, 'c-c'); return this; }, isBorderBox : function(){ return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox; }, getBox : function(contentBox, local){ var xy; if(!local){ xy = this.getXY(); }else{ var left = parseInt(this.getStyle("left"), 10) || 0; var top = parseInt(this.getStyle("top"), 10) || 0; xy = [left, top]; } var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx; if(!contentBox){ bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h}; }else{ var l = this.getBorderWidth("l")+this.getPadding("l"); var r = this.getBorderWidth("r")+this.getPadding("r"); var t = this.getBorderWidth("t")+this.getPadding("t"); var b = this.getBorderWidth("b")+this.getPadding("b"); bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)}; } bx.right = bx.x + bx.width; bx.bottom = bx.y + bx.height; return bx; }, getFrameWidth : function(sides, onlyContentBox){ return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides)); }, setBox : function(box, adjust, animate){ var w = box.width, h = box.height; if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){ w -= (this.getBorderWidth("lr") + this.getPadding("lr")); h -= (this.getBorderWidth("tb") + this.getPadding("tb")); } this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2)); return this; }, repaint : function(){ var dom = this.dom; this.addClass("x-repaint"); setTimeout(function(){ Ext.get(dom).removeClass("x-repaint"); }, 1); return this; }, getMargins : function(side){ if(!side){ return { top: parseInt(this.getStyle("margin-top"), 10) || 0, left: parseInt(this.getStyle("margin-left"), 10) || 0, bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0, right: parseInt(this.getStyle("margin-right"), 10) || 0 }; }else{ return this.addStyles(side, El.margins); } }, addStyles : function(sides, styles){ var val = 0, v, w; for(var i = 0, len = sides.length; i < len; i++){ v = this.getStyle(styles[sides.charAt(i)]); if(v){ w = parseInt(v, 10); if(w){ val += (w >= 0 ? w : -1 * w); } } } return val; }, createProxy : function(config, renderTo, matchBox){ config = typeof config == "object" ? config : {tag : "div", cls: config}; var proxy; if(renderTo){ proxy = Ext.DomHelper.append(renderTo, config, true); }else { proxy = Ext.DomHelper.insertBefore(this.dom, config, true); } if(matchBox){ proxy.setBox(this.getBox()); } return proxy; }, mask : function(msg, msgCls){ if(this.getStyle("position") == "static"){ this.setStyle("position", "relative"); } if(this._maskMsg){ this._maskMsg.remove(); } if(this._mask){ this._mask.remove(); } this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true); this.addClass("x-masked"); this._mask.setDisplayed(true); if(typeof msg == 'string'){ this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true); var mm = this._maskMsg; mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg"; mm.dom.firstChild.innerHTML = msg; mm.setDisplayed(true); mm.center(this); } if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ this._mask.setSize(this.dom.clientWidth, this.getHeight()); } return this._mask; }, unmask : function(){ if(this._mask){ if(this._maskMsg){ this._maskMsg.remove(); delete this._maskMsg; } this._mask.remove(); delete this._mask; } this.removeClass("x-masked"); }, isMasked : function(){ return this._mask && this._mask.isVisible(); }, createShim : function(){ var el = document.createElement('iframe'); el.frameBorder = 'no'; el.className = 'ext-shim'; if(Ext.isIE && Ext.isSecure){ el.src = Ext.SSL_SECURE_URL; } var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom)); shim.autoBoxAdjust = false; return shim; }, remove : function(){ Ext.removeNode(this.dom); delete El.cache[this.dom.id]; }, hover : function(overFn, outFn, scope){ var preOverFn = function(e){ if(!e.within(this, true)){ overFn.apply(scope || this, arguments); } }; var preOutFn = function(e){ if(!e.within(this, true)){ outFn.apply(scope || this, arguments); } }; this.on("mouseover", preOverFn, this.dom); this.on("mouseout", preOutFn, this.dom); return this; }, addClassOnOver : function(className, preventFlicker){ this.hover( function(){ Ext.fly(this, '_internal').addClass(className); }, function(){ Ext.fly(this, '_internal').removeClass(className); } ); return this; }, addClassOnFocus : function(className){ this.on("focus", function(){ Ext.fly(this, '_internal').addClass(className); }, this.dom); this.on("blur", function(){ Ext.fly(this, '_internal').removeClass(className); }, this.dom); return this; }, addClassOnClick : function(className){ var dom = this.dom; this.on("mousedown", function(){ Ext.fly(dom, '_internal').addClass(className); var d = Ext.getDoc(); var fn = function(){ Ext.fly(dom, '_internal').removeClass(className); d.removeListener("mouseup", fn); }; d.on("mouseup", fn); }); return this; }, swallowEvent : function(eventName, preventDefault){ var fn = function(e){ e.stopPropagation(); if(preventDefault){ e.preventDefault(); } }; if(Ext.isArray(eventName)){ for(var i = 0, len = eventName.length; i < len; i++){ this.on(eventName[i], fn); } return this; } this.on(eventName, fn); return this; }, parent : function(selector, returnDom){ return this.matchNode('parentNode', 'parentNode', selector, returnDom); }, next : function(selector, returnDom){ return this.matchNode('nextSibling', 'nextSibling', selector, returnDom); }, prev : function(selector, returnDom){ return this.matchNode('previousSibling', 'previousSibling', selector, returnDom); }, first : function(selector, returnDom){ return this.matchNode('nextSibling', 'firstChild', selector, returnDom); }, last : function(selector, returnDom){ return this.matchNode('previousSibling', 'lastChild', selector, returnDom); }, matchNode : function(dir, start, selector, returnDom){ var n = this.dom[start]; while(n){ if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){ return !returnDom ? Ext.get(n) : n; } n = n[dir]; } return null; }, appendChild: function(el){ el = Ext.get(el); el.appendTo(this); return this; }, createChild: function(config, insertBefore, returnDom){ config = config || {tag:'div'}; if(insertBefore){ return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true); } return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true); }, appendTo: function(el){ el = Ext.getDom(el); el.appendChild(this.dom); return this; }, insertBefore: function(el){ el = Ext.getDom(el); el.parentNode.insertBefore(this.dom, el); return this; }, insertAfter: function(el){ el = Ext.getDom(el); el.parentNode.insertBefore(this.dom, el.nextSibling); return this; }, insertFirst: function(el, returnDom){ el = el || {}; if(typeof el == 'object' && !el.nodeType && !el.dom){ return this.createChild(el, this.dom.firstChild, returnDom); }else{ el = Ext.getDom(el); this.dom.insertBefore(el, this.dom.firstChild); return !returnDom ? Ext.get(el) : el; } }, insertSibling: function(el, where, returnDom){ var rt; if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++){ rt = this.insertSibling(el[i], where, returnDom); } return rt; } where = where ? where.toLowerCase() : 'before'; el = el || {}; var refNode = where == 'before' ? this.dom : this.dom.nextSibling; if(typeof el == 'object' && !el.nodeType && !el.dom){ if(where == 'after' && !this.dom.nextSibling){ rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom); }else{ rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom); } }else{ rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode); if(!returnDom){ rt = Ext.get(rt); } } return rt; }, wrap: function(config, returnDom){ if(!config){ config = {tag: "div"}; } var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom); newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom); return newEl; }, replace: function(el){ el = Ext.get(el); this.insertBefore(el); el.remove(); return this; }, replaceWith: function(el){ if(typeof el == 'object' && !el.nodeType && !el.dom){ el = this.insertSibling(el, 'before'); }else{ el = Ext.getDom(el); this.dom.parentNode.insertBefore(el, this.dom); } El.uncache(this.id); this.dom.parentNode.removeChild(this.dom); this.dom = el; this.id = Ext.id(el); El.cache[this.id] = this; return this; }, insertHtml : function(where, html, returnEl){ var el = Ext.DomHelper.insertHtml(where, this.dom, html); return returnEl ? Ext.get(el) : el; }, set : function(o, useSet){ var el = this.dom; useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet; for(var attr in o){ if(attr == "style" || typeof o[attr] == "function") continue; if(attr=="cls"){ el.className = o["cls"]; }else if(o.hasOwnProperty(attr)){ if(useSet) el.setAttribute(attr, o[attr]); else el[attr] = o[attr]; } } if(o.style){ Ext.DomHelper.applyStyles(el, o.style); } return this; }, addKeyListener : function(key, fn, scope){ var config; if(typeof key != "object" || Ext.isArray(key)){ config = { key: key, fn: fn, scope: scope }; }else{ config = { key : key.key, shift : key.shift, ctrl : key.ctrl, alt : key.alt, fn: fn, scope: scope }; } return new Ext.KeyMap(this, config); }, addKeyMap : function(config){ return new Ext.KeyMap(this, config); }, isScrollable : function(){ var dom = this.dom; return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth; }, scrollTo : function(side, value, animate){ var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop"; if(!animate || !A){ this.dom[prop] = value; }else{ var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value]; this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll'); } return this; }, scroll : function(direction, distance, animate){ if(!this.isScrollable()){ return; } var el = this.dom; var l = el.scrollLeft, t = el.scrollTop; var w = el.scrollWidth, h = el.scrollHeight; var cw = el.clientWidth, ch = el.clientHeight; direction = direction.toLowerCase(); var scrolled = false; var a = this.preanim(arguments, 2); switch(direction){ case "l": case "left": if(w - l > cw){ var v = Math.min(l + distance, w-cw); this.scrollTo("left", v, a); scrolled = true; } break; case "r": case "right": if(l > 0){ var v = Math.max(l - distance, 0); this.scrollTo("left", v, a); scrolled = true; } break; case "t": case "top": case "up": if(t > 0){ var v = Math.max(t - distance, 0); this.scrollTo("top", v, a); scrolled = true; } break; case "b": case "bottom": case "down": if(h - t > ch){ var v = Math.min(t + distance, h-ch); this.scrollTo("top", v, a); scrolled = true; } break; } return scrolled; }, translatePoints : function(x, y){ if(typeof x == 'object' || Ext.isArray(x)){ y = x[1]; x = x[0]; } var p = this.getStyle('position'); var o = this.getXY(); var l = parseInt(this.getStyle('left'), 10); var t = parseInt(this.getStyle('top'), 10); if(isNaN(l)){ l = (p == "relative") ? 0 : this.dom.offsetLeft; } if(isNaN(t)){ t = (p == "relative") ? 0 : this.dom.offsetTop; } return {left: (x - o[0] + l), top: (y - o[1] + t)}; }, getScroll : function(){ var d = this.dom, doc = document; if(d == doc || d == doc.body){ var l, t; if(Ext.isIE && Ext.isStrict){ l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0); t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0); }else{ l = window.pageXOffset || (doc.body.scrollLeft || 0); t = window.pageYOffset || (doc.body.scrollTop || 0); } return {left: l, top: t}; }else{ return {left: d.scrollLeft, top: d.scrollTop}; } }, getColor : function(attr, defaultValue, prefix){ var v = this.getStyle(attr); if(!v || v == "transparent" || v == "inherit") { return defaultValue; } var color = typeof prefix == "undefined" ? "#" : prefix; if(v.substr(0, 4) == "rgb("){ var rvs = v.slice(4, v.length -1).split(","); for(var i = 0; i < 3; i++){ var h = parseInt(rvs[i]); var s = h.toString(16); if(h < 16){ s = "0" + s; } color += s; } } else { if(v.substr(0, 1) == "#"){ if(v.length == 4) { for(var i = 1; i < 4; i++){ var c = v.charAt(i); color += c + c; } }else if(v.length == 7){ color += v.substr(1); } } } return(color.length > 5 ? color.toLowerCase() : defaultValue); }, boxWrap : function(cls){ cls = cls || 'x-box'; var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls))); el.child('.'+cls+'-mc').dom.appendChild(this.dom); return el; }, getAttributeNS : Ext.isIE ? function(ns, name){ var d = this.dom; var type = typeof d[ns+":"+name]; if(type != 'undefined' && type != 'unknown'){ return d[ns+":"+name]; } return d[name]; } : function(ns, name){ var d = this.dom; return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name]; }, getTextWidth : function(text, min, max){ return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000); } }; var ep = El.prototype; ep.on = ep.addListener; ep.mon = ep.addListener; ep.getUpdateManager = ep.getUpdater; ep.un = ep.removeListener; ep.autoBoxAdjust = true; El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i; El.addUnits = function(v, defaultUnit){ if(v === "" || v == "auto"){ return v; } if(v === undefined){ return ''; } if(typeof v == "number" || !El.unitPattern.test(v)){ return v + (defaultUnit || 'px'); } return v; }; El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>'; El.VISIBILITY = 1; El.DISPLAY = 2; El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"}; El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"}; El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"}; El.cache = {}; var docEl; El.get = function(el){ var ex, elm, id; if(!el){ return null; } if(typeof el == "string"){ if(!(elm = document.getElementById(el))){ return null; } if(ex = El.cache[el]){ ex.dom = elm; }else{ ex = El.cache[el] = new El(elm); } return ex; }else if(el.tagName){ if(!(id = el.id)){ id = Ext.id(el); } if(ex = El.cache[id]){ ex.dom = el; }else{ ex = El.cache[id] = new El(el); } return ex; }else if(el instanceof El){ if(el != docEl){ el.dom = document.getElementById(el.id) || el.dom; El.cache[el.id] = el; } return el; }else if(el.isComposite){ return el; }else if(Ext.isArray(el)){ return El.select(el); }else if(el == document){ if(!docEl){ var f = function(){}; f.prototype = El.prototype; docEl = new f(); docEl.dom = document; } return docEl; } return null; }; El.uncache = function(el){ for(var i = 0, a = arguments, len = a.length; i < len; i++) { if(a[i]){ delete El.cache[a[i].id || a[i]]; } } }; El.garbageCollect = function(){ if(!Ext.enableGarbageCollector){ clearInterval(El.collectorThread); return; } for(var eid in El.cache){ var el = El.cache[eid], d = el.dom; if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){ delete El.cache[eid]; if(d && Ext.enableListenerCollection){ E.purgeElement(d); } } } } El.collectorThreadId = setInterval(El.garbageCollect, 30000); var flyFn = function(){}; flyFn.prototype = El.prototype; var _cls = new flyFn(); El.Flyweight = function(dom){ this.dom = dom; }; El.Flyweight.prototype = _cls; El.Flyweight.prototype.isFlyweight = true; El._flyweights = {}; El.fly = function(el, named){ named = named || '_global'; el = Ext.getDom(el); if(!el){ return null; } if(!El._flyweights[named]){ El._flyweights[named] = new El.Flyweight(); } El._flyweights[named].dom = el; return El._flyweights[named]; }; Ext.get = El.get; Ext.fly = El.fly; var noBoxAdjust = Ext.isStrict ? { select:1 } : { input:1, select:1, textarea:1 }; if(Ext.isIE || Ext.isGecko){ noBoxAdjust['button'] = 1; } Ext.EventManager.on(window, 'unload', function(){ delete El.cache; delete El._flyweights; }); })(); Ext.enableFx = true; Ext.Fx = { slideIn : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "t"; this.fixDisplay(); var r = this.getFxRestore(); var b = this.getBox(); this.setSize(b); var wrap = this.fxWrap(r.pos, o, "hidden"); var st = this.dom.style; st.visibility = "visible"; st.position = "absolute"; var after = function(){ el.fxUnwrap(wrap, r.pos, o); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height}; switch(anchor.toLowerCase()){ case "t": wrap.setSize(b.width, 0); st.left = st.bottom = "0"; a = {height: bh}; break; case "l": wrap.setSize(0, b.height); st.right = st.top = "0"; a = {width: bw}; break; case "r": wrap.setSize(0, b.height); wrap.setX(b.right); st.left = st.top = "0"; a = {width: bw, points: pt}; break; case "b": wrap.setSize(b.width, 0); wrap.setY(b.bottom); st.left = st.top = "0"; a = {height: bh, points: pt}; break; case "tl": wrap.setSize(0, 0); st.right = st.bottom = "0"; a = {width: bw, height: bh}; break; case "bl": wrap.setSize(0, 0); wrap.setY(b.y+b.height); st.right = st.top = "0"; a = {width: bw, height: bh, points: pt}; break; case "br": wrap.setSize(0, 0); wrap.setXY([b.right, b.bottom]); st.left = st.top = "0"; a = {width: bw, height: bh, points: pt}; break; case "tr": wrap.setSize(0, 0); wrap.setX(b.x+b.width); st.left = st.bottom = "0"; a = {width: bw, height: bh, points: pt}; break; } this.dom.style.visibility = "visible"; wrap.show(); arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5, 'easeOut', after); }); return this; }, slideOut : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "t"; var r = this.getFxRestore(); var b = this.getBox(); this.setSize(b); var wrap = this.fxWrap(r.pos, o, "visible"); var st = this.dom.style; st.visibility = "visible"; st.position = "absolute"; wrap.setSize(b); var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.fxUnwrap(wrap, r.pos, o); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a, zero = {to: 0}; switch(anchor.toLowerCase()){ case "t": st.left = st.bottom = "0"; a = {height: zero}; break; case "l": st.right = st.top = "0"; a = {width: zero}; break; case "r": st.left = st.top = "0"; a = {width: zero, points: {to:[b.right, b.y]}}; break; case "b": st.left = st.top = "0"; a = {height: zero, points: {to:[b.x, b.bottom]}}; break; case "tl": st.right = st.bottom = "0"; a = {width: zero, height: zero}; break; case "bl": st.right = st.top = "0"; a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}}; break; case "br": st.left = st.top = "0"; a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}}; break; case "tr": st.left = st.bottom = "0"; a = {width: zero, height: zero, points: {to:[b.right, b.y]}}; break; } arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5, "easeOut", after); }); return this; }, puff : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.clearOpacity(); this.show(); var r = this.getFxRestore(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; st.fontSize = ''; el.afterFx(o); }; var width = this.getWidth(); var height = this.getHeight(); arguments.callee.anim = this.fxanim({ width : {to: this.adjustWidth(width * 2)}, height : {to: this.adjustHeight(height * 2)}, points : {by: [-(width * .5), -(height * .5)]}, opacity : {to: 0}, fontSize: {to:200, unit: "%"} }, o, 'motion', .5, "easeOut", after); }); return this; }, switchOff : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.clearOpacity(); this.clip(); var r = this.getFxRestore(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; el.afterFx(o); }; this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){ this.clearOpacity(); (function(){ this.fxanim({ height:{to:1}, points:{by:[0, this.getHeight() * .5]} }, o, 'motion', 0.3, 'easeIn', after); }).defer(100, this); }); }); return this; }, highlight : function(color, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ color = color || "ffff9c"; var attr = o.attr || "backgroundColor"; this.clearOpacity(); this.show(); var origColor = this.getColor(attr); var restoreColor = this.dom.style[attr]; var endColor = (o.endColor || origColor) || "ffffff"; var after = function(){ el.dom.style[attr] = restoreColor; el.afterFx(o); }; var a = {}; a[attr] = {from: color, to: endColor}; arguments.callee.anim = this.fxanim(a, o, 'color', 1, 'easeIn', after); }); return this; }, frame : function(color, count, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ color = color || "#C3DAF9"; if(color.length == 6){ color = "#" + color; } count = count || 1; var duration = o.duration || 1; this.show(); var b = this.getBox(); var animFn = function(){ var proxy = Ext.getBody().createChild({ style:{ visbility:"hidden", position:"absolute", "z-index":"35000", border:"0px solid " + color } }); var scale = Ext.isBorderBox ? 2 : 1; proxy.animate({ top:{from:b.y, to:b.y - 20}, left:{from:b.x, to:b.x - 20}, borderWidth:{from:0, to:10}, opacity:{from:1, to:0}, height:{from:b.height, to:(b.height + (20*scale))}, width:{from:b.width, to:(b.width + (20*scale))} }, duration, function(){ proxy.remove(); if(--count > 0){ animFn(); }else{ el.afterFx(o); } }); }; animFn.call(this); }); return this; }, pause : function(seconds){ var el = this.getFxEl(); var o = {}; el.queueFx(o, function(){ setTimeout(function(){ el.afterFx(o); }, seconds * 1000); }); return this; }, fadeIn : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.setOpacity(0); this.fixDisplay(); this.dom.style.visibility = 'visible'; var to = o.endOpacity || 1; arguments.callee.anim = this.fxanim({opacity:{to:to}}, o, null, .5, "easeOut", function(){ if(to == 1){ this.clearOpacity(); } el.afterFx(o); }); }); return this; }, fadeOut : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}}, o, null, .5, "easeOut", function(){ if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){ this.dom.style.display = "none"; }else{ this.dom.style.visibility = "hidden"; } this.clearOpacity(); el.afterFx(o); }); }); return this; }, scale : function(w, h, o){ this.shift(Ext.apply({}, o, { width: w, height: h })); return this; }, shift : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity; if(w !== undefined){ a.width = {to: this.adjustWidth(w)}; } if(h !== undefined){ a.height = {to: this.adjustHeight(h)}; } if(x !== undefined || y !== undefined){ a.points = {to: [ x !== undefined ? x : this.getX(), y !== undefined ? y : this.getY() ]}; } if(op !== undefined){ a.opacity = {to: op}; } if(o.xy !== undefined){ a.points = {to: o.xy}; } arguments.callee.anim = this.fxanim(a, o, 'motion', .35, "easeOut", function(){ el.afterFx(o); }); }); return this; }, ghost : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "b"; var r = this.getFxRestore(); var w = this.getWidth(), h = this.getHeight(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a = {opacity: {to: 0}, points: {}}, pt = a.points; switch(anchor.toLowerCase()){ case "t": pt.by = [0, -h]; break; case "l": pt.by = [-w, 0]; break; case "r": pt.by = [w, 0]; break; case "b": pt.by = [0, h]; break; case "tl": pt.by = [-w, -h]; break; case "bl": pt.by = [-w, h]; break; case "br": pt.by = [w, h]; break; case "tr": pt.by = [w, -h]; break; } arguments.callee.anim = this.fxanim(a, o, 'motion', .5, "easeOut", after); }); return this; }, syncFx : function(){ this.fxDefaults = Ext.apply(this.fxDefaults || {}, { block : false, concurrent : true, stopFx : false }); return this; }, sequenceFx : function(){ this.fxDefaults = Ext.apply(this.fxDefaults || {}, { block : false, concurrent : false, stopFx : false }); return this; }, nextFx : function(){ var ef = this.fxQueue[0]; if(ef){ ef.call(this); } }, hasActiveFx : function(){ return this.fxQueue && this.fxQueue[0]; }, stopFx : function(){ if(this.hasActiveFx()){ var cur = this.fxQueue[0]; if(cur && cur.anim && cur.anim.isAnimated()){ this.fxQueue = [cur]; cur.anim.stop(true); } } return this; }, beforeFx : function(o){ if(this.hasActiveFx() && !o.concurrent){ if(o.stopFx){ this.stopFx(); return true; } return false; } return true; }, hasFxBlock : function(){ var q = this.fxQueue; return q && q[0] && q[0].block; }, queueFx : function(o, fn){ if(!this.fxQueue){ this.fxQueue = []; } if(!this.hasFxBlock()){ Ext.applyIf(o, this.fxDefaults); if(!o.concurrent){ var run = this.beforeFx(o); fn.block = o.block; this.fxQueue.push(fn); if(run){ this.nextFx(); } }else{ fn.call(this); } } return this; }, fxWrap : function(pos, o, vis){ var wrap; if(!o.wrap || !(wrap = Ext.get(o.wrap))){ var wrapXY; if(o.fixPosition){ wrapXY = this.getXY(); } var div = document.createElement("div"); div.style.visibility = vis; wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom)); wrap.setPositioning(pos); if(wrap.getStyle("position") == "static"){ wrap.position("relative"); } this.clearPositioning('auto'); wrap.clip(); wrap.dom.appendChild(this.dom); if(wrapXY){ wrap.setXY(wrapXY); } } return wrap; }, fxUnwrap : function(wrap, pos, o){ this.clearPositioning(); this.setPositioning(pos); if(!o.wrap){ wrap.dom.parentNode.insertBefore(this.dom, wrap.dom); wrap.remove(); } }, getFxRestore : function(){ var st = this.dom.style; return {pos: this.getPositioning(), width: st.width, height : st.height}; }, afterFx : function(o){ if(o.afterStyle){ this.applyStyles(o.afterStyle); } if(o.afterCls){ this.addClass(o.afterCls); } if(o.remove === true){ this.remove(); } Ext.callback(o.callback, o.scope, [this]); if(!o.concurrent){ this.fxQueue.shift(); this.nextFx(); } }, getFxEl : function(){ return Ext.get(this.dom); }, fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){ animType = animType || 'run'; opt = opt || {}; var anim = Ext.lib.Anim[animType]( this.dom, args, (opt.duration || defaultDur) || .35, (opt.easing || defaultEase) || 'easeOut', function(){ Ext.callback(cb, this); }, this ); opt.anim = anim; return anim; } }; Ext.Fx.resize = Ext.Fx.scale; Ext.apply(Ext.Element.prototype, Ext.Fx); Ext.CompositeElement = function(els){ this.elements = []; this.addElements(els); }; Ext.CompositeElement.prototype = { isComposite: true, addElements : function(els){ if(!els) return this; if(typeof els == "string"){ els = Ext.Element.selectorFunction(els); } var yels = this.elements; var index = yels.length-1; for(var i = 0, len = els.length; i < len; i++) { yels[++index] = Ext.get(els[i]); } return this; }, fill : function(els){ this.elements = []; this.add(els); return this; }, filter : function(selector){ var els = []; this.each(function(el){ if(el.is(selector)){ els[els.length] = el.dom; } }); this.fill(els); return this; }, invoke : function(fn, args){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++) { Ext.Element.prototype[fn].apply(els[i], args); } return this; }, add : function(els){ if(typeof els == "string"){ this.addElements(Ext.Element.selectorFunction(els)); }else if(els.length !== undefined){ this.addElements(els); }else{ this.addElements([els]); } return this; }, each : function(fn, scope){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++){ if(fn.call(scope || els[i], els[i], this, i) === false) { break; } } return this; }, item : function(index){ return this.elements[index] || null; }, first : function(){ return this.item(0); }, last : function(){ return this.item(this.elements.length-1); }, getCount : function(){ return this.elements.length; }, contains : function(el){ return this.indexOf(el) !== -1; }, indexOf : function(el){ return this.elements.indexOf(Ext.get(el)); }, removeElement : function(el, removeDom){ if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++){ this.removeElement(el[i]); } return this; } var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1 && this.elements[index]){ if(removeDom){ var d = this.elements[index]; if(d.dom){ d.remove(); }else{ Ext.removeNode(d); } } this.elements.splice(index, 1); } return this; }, replaceElement : function(el, replacement, domReplace){ var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1){ if(domReplace){ this.elements[index].replaceWith(replacement); }else{ this.elements.splice(index, 1, Ext.get(replacement)) } } return this; }, clear : function(){ this.elements = []; } }; (function(){ Ext.CompositeElement.createCall = function(proto, fnName){ if(!proto[fnName]){ proto[fnName] = function(){ return this.invoke(fnName, arguments); }; } }; for(var fnName in Ext.Element.prototype){ if(typeof Ext.Element.prototype[fnName] == "function"){ Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName); } }; })(); Ext.CompositeElementLite = function(els){ Ext.CompositeElementLite.superclass.constructor.call(this, els); this.el = new Ext.Element.Flyweight(); }; Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, { addElements : function(els){ if(els){ if(Ext.isArray(els)){ this.elements = this.elements.concat(els); }else{ var yels = this.elements; var index = yels.length-1; for(var i = 0, len = els.length; i < len; i++) { yels[++index] = els[i]; } } } return this; }, invoke : function(fn, args){ var els = this.elements; var el = this.el; for(var i = 0, len = els.length; i < len; i++) { el.dom = els[i]; Ext.Element.prototype[fn].apply(el, args); } return this; }, item : function(index){ if(!this.elements[index]){ return null; } this.el.dom = this.elements[index]; return this.el; }, addListener : function(eventName, handler, scope, opt){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++) { Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt); } return this; }, each : function(fn, scope){ var els = this.elements; var el = this.el; for(var i = 0, len = els.length; i < len; i++){ el.dom = els[i]; if(fn.call(scope || el, el, this, i) === false){ break; } } return this; }, indexOf : function(el){ return this.elements.indexOf(Ext.getDom(el)); }, replaceElement : function(el, replacement, domReplace){ var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1){ replacement = Ext.getDom(replacement); if(domReplace){ var d = this.elements[index]; d.parentNode.insertBefore(replacement, d); Ext.removeNode(d); } this.elements.splice(index, 1, replacement); } return this; } }); Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener; if(Ext.DomQuery){ Ext.Element.selectorFunction = Ext.DomQuery.select; } Ext.Element.select = function(selector, unique, root){ var els; if(typeof selector == "string"){ els = Ext.Element.selectorFunction(selector, root); }else if(selector.length !== undefined){ els = selector; }else{ throw "Invalid selector"; } if(unique === true){ return new Ext.CompositeElement(els); }else{ return new Ext.CompositeElementLite(els); } }; Ext.select = Ext.Element.select; Ext.data.Connection = function(config){ Ext.apply(this, config); this.addEvents( "beforerequest", "requestcomplete", "requestexception" ); Ext.data.Connection.superclass.constructor.call(this); }; Ext.extend(Ext.data.Connection, Ext.util.Observable, { timeout : 30000, autoAbort:false, disableCaching: true, request : function(o){ if(this.fireEvent("beforerequest", this, o) !== false){ var p = o.params; if(typeof p == "function"){ p = p.call(o.scope||window, o); } if(typeof p == "object"){ p = Ext.urlEncode(p); } if(this.extraParams){ var extras = Ext.urlEncode(this.extraParams); p = p ? (p + '&' + extras) : extras; } var url = o.url || this.url; if(typeof url == 'function'){ url = url.call(o.scope||window, o); } if(o.form){ var form = Ext.getDom(o.form); url = url || form.action; var enctype = form.getAttribute("enctype"); if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){ return this.doFormUpload(o, p, url); } var f = Ext.lib.Ajax.serializeForm(form); p = p ? (p + '&' + f) : f; } var hs = o.headers; if(this.defaultHeaders){ hs = Ext.apply(hs || {}, this.defaultHeaders); if(!o.headers){ o.headers = hs; } } var cb = { success: this.handleResponse, failure: this.handleFailure, scope: this, argument: {options: o}, timeout : o.timeout || this.timeout }; var method = o.method||this.method||(p ? "POST" : "GET"); if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){ url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime()); } if(typeof o.autoAbort == 'boolean'){ if(o.autoAbort){ this.abort(); } }else if(this.autoAbort !== false){ this.abort(); } if((method == 'GET' && p) || o.xmlData || o.jsonData){ url += (url.indexOf('?') != -1 ? '&' : '?') + p; p = ''; } this.transId = Ext.lib.Ajax.request(method, url, cb, p, o); return this.transId; }else{ Ext.callback(o.callback, o.scope, [o, null, null]); return null; } }, isLoading : function(transId){ if(transId){ return Ext.lib.Ajax.isCallInProgress(transId); }else{ return this.transId ? true : false; } }, abort : function(transId){ if(transId || this.isLoading()){ Ext.lib.Ajax.abort(transId || this.transId); } }, handleResponse : function(response){ this.transId = false; var options = response.argument.options; response.argument = options ? options.argument : null; this.fireEvent("requestcomplete", this, response, options); Ext.callback(options.success, options.scope, [response, options]); Ext.callback(options.callback, options.scope, [options, true, response]); }, handleFailure : function(response, e){ this.transId = false; var options = response.argument.options; response.argument = options ? options.argument : null; this.fireEvent("requestexception", this, response, options, e); Ext.callback(options.failure, options.scope, [response, options]); Ext.callback(options.callback, options.scope, [options, false, response]); }, doFormUpload : function(o, ps, url){ var id = Ext.id(); var frame = document.createElement('iframe'); frame.id = id; frame.name = id; frame.className = 'x-hidden'; if(Ext.isIE){ frame.src = Ext.SSL_SECURE_URL; } document.body.appendChild(frame); if(Ext.isIE){ document.frames[id].name = id; } var form = Ext.getDom(o.form); form.target = id; form.method = 'POST'; form.enctype = form.encoding = 'multipart/form-data'; if(url){ form.action = url; } var hiddens, hd; if(ps){ hiddens = []; ps = Ext.urlDecode(ps, false); for(var k in ps){ if(ps.hasOwnProperty(k)){ hd = document.createElement('input'); hd.type = 'hidden'; hd.name = k; hd.value = ps[k]; form.appendChild(hd); hiddens.push(hd); } } } function cb(){ var r = { responseText : '', responseXML : null }; r.argument = o ? o.argument : null; try { var doc; if(Ext.isIE){ doc = frame.contentWindow.document; }else { doc = (frame.contentDocument || window.frames[id].document); } if(doc && doc.body){ r.responseText = doc.body.innerHTML; } if(doc && doc.XMLDocument){ r.responseXML = doc.XMLDocument; }else { r.responseXML = doc; } } catch(e) { } Ext.EventManager.removeListener(frame, 'load', cb, this); this.fireEvent("requestcomplete", this, r, o); Ext.callback(o.success, o.scope, [r, o]); Ext.callback(o.callback, o.scope, [o, true, r]); setTimeout(function(){Ext.removeNode(frame);}, 100); } Ext.EventManager.on(frame, 'load', cb, this); form.submit(); if(hiddens){ for(var i = 0, len = hiddens.length; i < len; i++){ Ext.removeNode(hiddens[i]); } } } }); Ext.Ajax = new Ext.data.Connection({ autoAbort : false, serializeForm : function(form){ return Ext.lib.Ajax.serializeForm(form); } }); Ext.Updater = function(el, forceNew){ el = Ext.get(el); if(!forceNew && el.updateManager){ return el.updateManager; } this.el = el; this.defaultUrl = null; this.addEvents( "beforeupdate", "update", "failure" ); var d = Ext.Updater.defaults; this.sslBlankUrl = d.sslBlankUrl; this.disableCaching = d.disableCaching; this.indicatorText = d.indicatorText; this.showLoadIndicator = d.showLoadIndicator; this.timeout = d.timeout; this.loadScripts = d.loadScripts; this.transaction = null; this.autoRefreshProcId = null; this.refreshDelegate = this.refresh.createDelegate(this); this.updateDelegate = this.update.createDelegate(this); this.formUpdateDelegate = this.formUpdate.createDelegate(this); if(!this.renderer){ this.renderer = new Ext.Updater.BasicRenderer(); } Ext.Updater.superclass.constructor.call(this); }; Ext.extend(Ext.Updater, Ext.util.Observable, { getEl : function(){ return this.el; }, update : function(url, params, callback, discardUrl){ if(this.fireEvent("beforeupdate", this.el, url, params) !== false){ var method = this.method, cfg, callerScope; if(typeof url == "object"){ cfg = url; url = cfg.url; params = params || cfg.params; callback = callback || cfg.callback; discardUrl = discardUrl || cfg.discardUrl; callerScope = cfg.scope; if(typeof cfg.method != "undefined"){method = cfg.method;}; if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;}; if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";}; if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;}; if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;}; } this.showLoading(); if(!discardUrl){ this.defaultUrl = url; } if(typeof url == "function"){ url = url.call(this); } method = method || (params ? "POST" : "GET"); if(method == "GET"){ url = this.prepareUrl(url); } var o = Ext.apply(cfg ||{}, { url : url, params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params, success: this.processSuccess, failure: this.processFailure, scope: this, callback: undefined, timeout: (this.timeout*1000), argument: { "options": cfg, "url": url, "form": null, "callback": callback, "scope": callerScope || window, "params": params } }); this.transaction = Ext.Ajax.request(o); } }, formUpdate : function(form, url, reset, callback){ if(this.fireEvent("beforeupdate", this.el, form, url) !== false){ if(typeof url == "function"){ url = url.call(this); } form = Ext.getDom(form) this.transaction = Ext.Ajax.request({ form: form, url:url, success: this.processSuccess, failure: this.processFailure, scope: this, timeout: (this.timeout*1000), argument: { "url": url, "form": form, "callback": callback, "reset": reset } }); this.showLoading.defer(1, this); } }, refresh : function(callback){ if(this.defaultUrl == null){ return; } this.update(this.defaultUrl, null, callback, true); }, startAutoRefresh : function(interval, url, params, callback, refreshNow){ if(refreshNow){ this.update(url || this.defaultUrl, params, callback, true); } if(this.autoRefreshProcId){ clearInterval(this.autoRefreshProcId); } this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000); }, stopAutoRefresh : function(){ if(this.autoRefreshProcId){ clearInterval(this.autoRefreshProcId); delete this.autoRefreshProcId; } }, isAutoRefreshing : function(){ return this.autoRefreshProcId ? true : false; }, showLoading : function(){ if(this.showLoadIndicator){ this.el.update(this.indicatorText); } }, prepareUrl : function(url){ if(this.disableCaching){ var append = "_dc=" + (new Date().getTime()); if(url.indexOf("?") !== -1){ url += "&" + append; }else{ url += "?" + append; } } return url; }, processSuccess : function(response){ this.transaction = null; if(response.argument.form && response.argument.reset){ try{ response.argument.form.reset(); }catch(e){} } if(this.loadScripts){ this.renderer.render(this.el, response, this, this.updateComplete.createDelegate(this, [response])); }else{ this.renderer.render(this.el, response, this); this.updateComplete(response); } }, updateComplete : function(response){ this.fireEvent("update", this.el, response); if(typeof response.argument.callback == "function"){ response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options); } }, processFailure : function(response){ this.transaction = null; this.fireEvent("failure", this.el, response); if(typeof response.argument.callback == "function"){ response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options); } }, setRenderer : function(renderer){ this.renderer = renderer; }, getRenderer : function(){ return this.renderer; }, setDefaultUrl : function(defaultUrl){ this.defaultUrl = defaultUrl; }, abort : function(){ if(this.transaction){ Ext.Ajax.abort(this.transaction); } }, isUpdating : function(){ if(this.transaction){ return Ext.Ajax.isLoading(this.transaction); } return false; } }); Ext.Updater.defaults = { timeout : 30, loadScripts : false, sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"), disableCaching : false, showLoadIndicator : true, indicatorText : '<div class="loading-indicator">Loading...</div>' }; Ext.Updater.updateElement = function(el, url, params, options){ var um = Ext.get(el).getUpdater(); Ext.apply(um, options); um.update(url, params, options ? options.callback : null); }; Ext.Updater.update = Ext.Updater.updateElement; Ext.Updater.BasicRenderer = function(){}; Ext.Updater.BasicRenderer.prototype = { render : function(el, response, updateManager, callback){ el.update(response.responseText, updateManager.loadScripts, callback); } }; Ext.UpdateManager = Ext.Updater; Date.parseFunctions = {count:0}; Date.parseRegexes = []; Date.formatFunctions = {count:0}; Date.prototype.dateFormat = function(format) { if (Date.formatFunctions[format] == null) { Date.createNewFormat(format); } var func = Date.formatFunctions[format]; return this[func](); }; Date.prototype.format = Date.prototype.dateFormat; Date.createNewFormat = function(format) { var funcName = "format" + Date.formatFunctions.count++; Date.formatFunctions[format] = funcName; var code = "Date.prototype." + funcName + " = function(){return "; var special = false; var ch = ''; for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; code += "'" + String.escape(ch) + "' + "; } else { code += Date.getFormatCode(ch); } } eval(code.substring(0, code.length - 3) + ";}"); }; Date.getFormatCode = function(character) { switch (character) { case "d": return "String.leftPad(this.getDate(), 2, '0') + "; case "D": return "Date.getShortDayName(this.getDay()) + "; case "j": return "this.getDate() + "; case "l": return "Date.dayNames[this.getDay()] + "; case "N": return "(this.getDay() ? this.getDay() : 7) + "; case "S": return "this.getSuffix() + "; case "w": return "this.getDay() + "; case "z": return "this.getDayOfYear() + "; case "W": return "String.leftPad(this.getWeekOfYear(), 2, '0') + "; case "F": return "Date.monthNames[this.getMonth()] + "; case "m": return "String.leftPad(this.getMonth() + 1, 2, '0') + "; case "M": return "Date.getShortMonthName(this.getMonth()) + "; case "n": return "(this.getMonth() + 1) + "; case "t": return "this.getDaysInMonth() + "; case "L": return "(this.isLeapYear() ? 1 : 0) + "; case "o": return "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0))) + "; case "Y": return "this.getFullYear() + "; case "y": return "('' + this.getFullYear()).substring(2, 4) + "; case "a": return "(this.getHours() < 12 ? 'am' : 'pm') + "; case "A": return "(this.getHours() < 12 ? 'AM' : 'PM') + "; case "g": return "((this.getHours() % 12) ? this.getHours() % 12 : 12) + "; case "G": return "this.getHours() + "; case "h": return "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + "; case "H": return "String.leftPad(this.getHours(), 2, '0') + "; case "i": return "String.leftPad(this.getMinutes(), 2, '0') + "; case "s": return "String.leftPad(this.getSeconds(), 2, '0') + "; case "u": return "String.leftPad(this.getMilliseconds(), 3, '0') + "; case "O": return "this.getGMTOffset() + "; case "P": return "this.getGMTOffset(true) + "; case "T": return "this.getTimezone() + "; case "Z": return "(this.getTimezoneOffset() * -60) + "; case "c": for (var df = Date.getFormatCode, c = "Y-m-dTH:i:sP", code = "", i = 0, l = c.length; i < l; ++i) { var e = c.charAt(i); code += e == "T" ? "'T' + " : df(e); } return code; case "U": return "Math.round(this.getTime() / 1000) + "; default: return "'" + String.escape(character) + "' + "; } }; Date.parseDate = function(input, format) { if (Date.parseFunctions[format] == null) { Date.createParser(format); } var func = Date.parseFunctions[format]; return Date[func](input); }; Date.createParser = function(format) { var funcName = "parse" + Date.parseFunctions.count++; var regexNum = Date.parseRegexes.length; var currentGroup = 1; Date.parseFunctions[format] = funcName; var code = "Date." + funcName + " = function(input){\n" + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, ms = -1, o, z, u, v;\n" + "input = String(input);var d = new Date();\n" + "y = d.getFullYear();\n" + "m = d.getMonth();\n" + "d = d.getDate();\n" + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" + "if (results && results.length > 0) {"; var regex = ""; var special = false; var ch = ''; for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; regex += String.escape(ch); } else { var obj = Date.formatCodeToRegex(ch, currentGroup); currentGroup += obj.g; regex += obj.s; if (obj.g && obj.c) { code += obj.c; } } } code += "if (u)\n" + "{v = new Date(u * 1000);}" + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\n" + "{v = new Date(y, m, d, h, i, s, ms);}\n" + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" + "{v = new Date(y, m, d, h, i, s);}\n" + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" + "{v = new Date(y, m, d, h, i);}\n" + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n" + "{v = new Date(y, m, d, h);}\n" + "else if (y >= 0 && m >= 0 && d > 0)\n" + "{v = new Date(y, m, d);}\n" + "else if (y >= 0 && m >= 0)\n" + "{v = new Date(y, m);}\n" + "else if (y >= 0)\n" + "{v = new Date(y);}\n" + "}return (v && (z || o))?\n" + " (z ? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n" + " v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n" + ";}"; Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", "i"); eval(code); }; Date.formatCodeToRegex = function(character, currentGroup) { switch (character) { case "d": return {g:1, c:"d = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "D": for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i); return {g:0, c:null, s:"(?:" + a.join("|") +")"}; case "j": return {g:1, c:"d = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "l": return {g:0, c:null, s:"(?:" + Date.dayNames.join("|") + ")"}; case "N": return {g:0, c:null, s:"[1-7]"}; case "S": return {g:0, c:null, s:"(?:st|nd|rd|th)"}; case "w": return {g:0, c:null, s:"[0-6]"}; case "z": return {g:0, c:null, s:"(?:\\d{1,3}"}; case "W": return {g:0, c:null, s:"(?:\\d{2})"}; case "F": return {g:1, c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n", s:"(" + Date.monthNames.join("|") + ")"}; case "m": return {g:1, c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", s:"(\\d{2})"}; case "M": for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i); return {g:1, c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n", s:"(" + a.join("|") + ")"}; case "n": return {g:1, c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", s:"(\\d{1,2})"}; case "t": return {g:0, c:null, s:"(?:\\d{2})"}; case "L": return {g:0, c:null, s:"(?:1|0)"}; case "o": case "Y": return {g:1, c:"y = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{4})"}; case "y": return {g:1, c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", s:"(\\d{1,2})"}; case "a": return {g:1, c:"if (results[" + currentGroup + "] == 'am') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(am|pm)"}; case "A": return {g:1, c:"if (results[" + currentGroup + "] == 'AM') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(AM|PM)"}; case "g": case "G": return {g:1, c:"h = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "h": case "H": return {g:1, c:"h = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "i": return {g:1, c:"i = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "s": return {g:1, c:"s = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "u": return {g:1, c:"ms = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{3})"}; case "O": return {g:1, c:[ "o = results[", currentGroup, "];\n", "var sn = o.substring(0,1);\n", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n", "var mn = o.substring(3,5) % 60;\n", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n", " (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" ].join(""), s: "([+\-]\\d{4})"}; case "P": return {g:1, c:[ "o = results[", currentGroup, "];\n", "var sn = o.substring(0,1);\n", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);\n", "var mn = o.substring(4,6) % 60;\n", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n", " (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" ].join(""), s: "([+\-]\\d{2}:\\d{2})"}; case "T": return {g:0, c:null, s:"[A-Z]{1,4}"}; case "Z": return {g:1, c:"z = results[" + currentGroup + "] * 1;\n" + "z = (-43200 <= z && z <= 50400)? z : null;\n", s:"([+\-]?\\d{1,5})"}; case "c": var df = Date.formatCodeToRegex, calc = []; var arr = [df("Y", 1), df("m", 2), df("d", 3), df("h", 4), df("i", 5), df("s", 6), df("P", 7)]; for (var i = 0, l = arr.length; i < l; ++i) { calc.push(arr[i].c); } return {g:1, c:calc.join(""), s:arr[0].s + "-" + arr[1].s + "-" + arr[2].s + "T" + arr[3].s + ":" + arr[4].s + ":" + arr[5].s + arr[6].s}; case "U": return {g:1, c:"u = parseInt(results[" + currentGroup + "], 10);\n", s:"(-?\\d+)"}; default: return {g:0, c:null, s:Ext.escapeRe(character)}; } }; Date.prototype.getTimezone = function() { return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, ""); }; Date.prototype.getGMTOffset = function(colon) { return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset() / 60)), 2, "0") + (colon ? ":" : "") + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); }; Date.prototype.getDayOfYear = function() { var num = 0; Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; for (var i = 0; i < this.getMonth(); ++i) { num += Date.daysInMonth[i]; } return num + this.getDate() - 1; }; Date.prototype.getWeekOfYear = function() { var ms1d = 864e5; var ms7d = 7 * ms1d; var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d; var AWN = Math.floor(DC3 / 7); var Wyr = new Date(AWN * ms7d).getUTCFullYear(); return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1; }; Date.prototype.isLeapYear = function() { var year = this.getFullYear(); return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); }; Date.prototype.getFirstDayOfMonth = function() { var day = (this.getDay() - (this.getDate() - 1)) % 7; return (day < 0) ? (day + 7) : day; }; Date.prototype.getLastDayOfMonth = function() { var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; return (day < 0) ? (day + 7) : day; }; Date.prototype.getFirstDateOfMonth = function() { return new Date(this.getFullYear(), this.getMonth(), 1); }; Date.prototype.getLastDateOfMonth = function() { return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth()); }; Date.prototype.getDaysInMonth = function() { Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; return Date.daysInMonth[this.getMonth()]; }; Date.prototype.getSuffix = function() { switch (this.getDate()) { case 1: case 21: case 31: return "st"; case 2: case 22: return "nd"; case 3: case 23: return "rd"; default: return "th"; } }; Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; Date.getShortMonthName = function(month) { return Date.monthNames[month].substring(0, 3); } Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; Date.getShortDayName = function(day) { return Date.dayNames[day].substring(0, 3); } Date.y2kYear = 50; Date.monthNumbers = { Jan:0, Feb:1, Mar:2, Apr:3, May:4, Jun:5, Jul:6, Aug:7, Sep:8, Oct:9, Nov:10, Dec:11}; Date.getMonthNumber = function(name) { return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()]; } Date.prototype.clone = function() { return new Date(this.getTime()); }; Date.prototype.clearTime = function(clone){ if(clone){ return this.clone().clearTime(); } this.setHours(0); this.setMinutes(0); this.setSeconds(0); this.setMilliseconds(0); return this; }; if(Ext.isSafari){ Date.brokenSetMonth = Date.prototype.setMonth; Date.prototype.setMonth = function(num){ if(num <= -1){ var n = Math.ceil(-num); var back_year = Math.ceil(n/12); var month = (n % 12) ? 12 - n % 12 : 0 ; this.setFullYear(this.getFullYear() - back_year); return Date.brokenSetMonth.call(this, month); } else { return Date.brokenSetMonth.apply(this, arguments); } }; } Date.MILLI = "ms"; Date.SECOND = "s"; Date.MINUTE = "mi"; Date.HOUR = "h"; Date.DAY = "d"; Date.MONTH = "mo"; Date.YEAR = "y"; Date.prototype.add = function(interval, value){ var d = this.clone(); if (!interval || value === 0) return d; switch(interval.toLowerCase()){ case Date.MILLI: d.setMilliseconds(this.getMilliseconds() + value); break; case Date.SECOND: d.setSeconds(this.getSeconds() + value); break; case Date.MINUTE: d.setMinutes(this.getMinutes() + value); break; case Date.HOUR: d.setHours(this.getHours() + value); break; case Date.DAY: d.setDate(this.getDate() + value); break; case Date.MONTH: var day = this.getDate(); if(day > 28){ day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate()); } d.setDate(day); d.setMonth(this.getMonth() + value); break; case Date.YEAR: d.setFullYear(this.getFullYear() + value); break; } return d; }; Date.prototype.between = function(start, end){ var t = this.getTime(); return start.getTime() <= t && t <= end.getTime(); } Ext.util.DelayedTask = function(fn, scope, args){ var id = null, d, t; var call = function(){ var now = new Date().getTime(); if(now - t >= d){ clearInterval(id); id = null; fn.apply(scope, args || []); } }; this.delay = function(delay, newFn, newScope, newArgs){ if(id && delay != d){ this.cancel(); } d = delay; t = new Date().getTime(); fn = newFn || fn; scope = newScope || scope; args = newArgs || args; if(!id){ id = setInterval(call, d); } }; this.cancel = function(){ if(id){ clearInterval(id); id = null; } }; }; Ext.util.TaskRunner = function(interval){ interval = interval || 10; var tasks = [], removeQueue = []; var id = 0; var running = false; var stopThread = function(){ running = false; clearInterval(id); id = 0; }; var startThread = function(){ if(!running){ running = true; id = setInterval(runTasks, interval); } }; var removeTask = function(t){ removeQueue.push(t); if(t.onStop){ t.onStop.apply(t.scope || t); } }; var runTasks = function(){ if(removeQueue.length > 0){ for(var i = 0, len = removeQueue.length; i < len; i++){ tasks.remove(removeQueue[i]); } removeQueue = []; if(tasks.length < 1){ stopThread(); return; } } var now = new Date().getTime(); for(var i = 0, len = tasks.length; i < len; ++i){ var t = tasks[i]; var itime = now - t.taskRunTime; if(t.interval <= itime){ var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]); t.taskRunTime = now; if(rt === false || t.taskRunCount === t.repeat){ removeTask(t); return; } } if(t.duration && t.duration <= (now - t.taskStartTime)){ removeTask(t); } } }; this.start = function(task){ tasks.push(task); task.taskStartTime = new Date().getTime(); task.taskRunTime = 0; task.taskRunCount = 0; startThread(); return task; }; this.stop = function(task){ removeTask(task); return task; }; this.stopAll = function(){ stopThread(); for(var i = 0, len = tasks.length; i < len; i++){ if(tasks[i].onStop){ tasks[i].onStop(); } } tasks = []; removeQueue = []; }; }; Ext.TaskMgr = new Ext.util.TaskRunner(); Ext.util.MixedCollection = function(allowFunctions, keyFn){ this.items = []; this.map = {}; this.keys = []; this.length = 0; this.addEvents( "clear", "add", "replace", "remove", "sort" ); this.allowFunctions = allowFunctions === true; if(keyFn){ this.getKey = keyFn; } Ext.util.MixedCollection.superclass.constructor.call(this); }; Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, { allowFunctions : false, add : function(key, o){ if(arguments.length == 1){ o = arguments[0]; key = this.getKey(o); } if(typeof key == "undefined" || key === null){ this.length++; this.items.push(o); this.keys.push(null); }else{ var old = this.map[key]; if(old){ return this.replace(key, o); } this.length++; this.items.push(o); this.map[key] = o; this.keys.push(key); } this.fireEvent("add", this.length-1, o, key); return o; }, getKey : function(o){ return o.id; }, replace : function(key, o){ if(arguments.length == 1){ o = arguments[0]; key = this.getKey(o); } var old = this.item(key); if(typeof key == "undefined" || key === null || typeof old == "undefined"){ return this.add(key, o); } var index = this.indexOfKey(key); this.items[index] = o; this.map[key] = o; this.fireEvent("replace", key, old, o); return o; }, addAll : function(objs){ if(arguments.length > 1 || Ext.isArray(objs)){ var args = arguments.length > 1 ? arguments : objs; for(var i = 0, len = args.length; i < len; i++){ this.add(args[i]); } }else{ for(var key in objs){ if(this.allowFunctions || typeof objs[key] != "function"){ this.add(key, objs[key]); } } } }, each : function(fn, scope){ var items = [].concat(this.items); for(var i = 0, len = items.length; i < len; i++){ if(fn.call(scope || items[i], items[i], i, len) === false){ break; } } }, eachKey : function(fn, scope){ for(var i = 0, len = this.keys.length; i < len; i++){ fn.call(scope || window, this.keys[i], this.items[i], i, len); } }, find : function(fn, scope){ for(var i = 0, len = this.items.length; i < len; i++){ if(fn.call(scope || window, this.items[i], this.keys[i])){ return this.items[i]; } } return null; }, insert : function(index, key, o){ if(arguments.length == 2){ o = arguments[1]; key = this.getKey(o); } if(index >= this.length){ return this.add(key, o); } this.length++; this.items.splice(index, 0, o); if(typeof key != "undefined" && key != null){ this.map[key] = o; } this.keys.splice(index, 0, key); this.fireEvent("add", index, o, key); return o; }, remove : function(o){ return this.removeAt(this.indexOf(o)); }, removeAt : function(index){ if(index < this.length && index >= 0){ this.length--; var o = this.items[index]; this.items.splice(index, 1); var key = this.keys[index]; if(typeof key != "undefined"){ delete this.map[key]; } this.keys.splice(index, 1); this.fireEvent("remove", o, key); return o; } return false; }, removeKey : function(key){ return this.removeAt(this.indexOfKey(key)); }, getCount : function(){ return this.length; }, indexOf : function(o){ return this.items.indexOf(o); }, indexOfKey : function(key){ return this.keys.indexOf(key); }, item : function(key){ var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key]; return typeof item != 'function' || this.allowFunctions ? item : null; }, itemAt : function(index){ return this.items[index]; }, key : function(key){ return this.map[key]; }, contains : function(o){ return this.indexOf(o) != -1; }, containsKey : function(key){ return typeof this.map[key] != "undefined"; }, clear : function(){ this.length = 0; this.items = []; this.keys = []; this.map = {}; this.fireEvent("clear"); }, first : function(){ return this.items[0]; }, last : function(){ return this.items[this.length-1]; }, _sort : function(property, dir, fn){ var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1; fn = fn || function(a, b){ return a-b; }; var c = [], k = this.keys, items = this.items; for(var i = 0, len = items.length; i < len; i++){ c[c.length] = {key: k[i], value: items[i], index: i}; } c.sort(function(a, b){ var v = fn(a[property], b[property]) * dsc; if(v == 0){ v = (a.index < b.index ? -1 : 1); } return v; }); for(var i = 0, len = c.length; i < len; i++){ items[i] = c[i].value; k[i] = c[i].key; } this.fireEvent("sort", this); }, sort : function(dir, fn){ this._sort("value", dir, fn); }, keySort : function(dir, fn){ this._sort("key", dir, fn || function(a, b){ return String(a).toUpperCase()-String(b).toUpperCase(); }); }, getRange : function(start, end){ var items = this.items; if(items.length < 1){ return []; } start = start || 0; end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1); var r = []; if(start <= end){ for(var i = start; i <= end; i++) { r[r.length] = items[i]; } }else{ for(var i = start; i >= end; i--) { r[r.length] = items[i]; } } return r; }, filter : function(property, value, anyMatch, caseSensitive){ if(Ext.isEmpty(value, false)){ return this.clone(); } value = this.createValueMatcher(value, anyMatch, caseSensitive); return this.filterBy(function(o){ return o && value.test(o[property]); }); }, filterBy : function(fn, scope){ var r = new Ext.util.MixedCollection(); r.getKey = this.getKey; var k = this.keys, it = this.items; for(var i = 0, len = it.length; i < len; i++){ if(fn.call(scope||this, it[i], k[i])){ r.add(k[i], it[i]); } } return r; }, findIndex : function(property, value, start, anyMatch, caseSensitive){ if(Ext.isEmpty(value, false)){ return -1; } value = this.createValueMatcher(value, anyMatch, caseSensitive); return this.findIndexBy(function(o){ return o && value.test(o[property]); }, null, start); }, findIndexBy : function(fn, scope, start){ var k = this.keys, it = this.items; for(var i = (start||0), len = it.length; i < len; i++){ if(fn.call(scope||this, it[i], k[i])){ return i; } } if(typeof start == 'number' && start > 0){ for(var i = 0; i < start; i++){ if(fn.call(scope||this, it[i], k[i])){ return i; } } } return -1; }, createValueMatcher : function(value, anyMatch, caseSensitive){ if(!value.exec){ value = String(value); value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), caseSensitive ? '' : 'i'); } return value; }, clone : function(){ var r = new Ext.util.MixedCollection(); var k = this.keys, it = this.items; for(var i = 0, len = it.length; i < len; i++){ r.add(k[i], it[i]); } r.getKey = this.getKey; return r; } }); Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item; Ext.util.JSON = new (function(){ var useHasOwn = {}.hasOwnProperty ? true : false; var pad = function(n) { return n < 10 ? "0" + n : n; }; var m = { "\b": '\\b', "\t": '\\t', "\n": '\\n', "\f": '\\f', "\r": '\\r', '"' : '\\"', "\\": '\\\\' }; var encodeString = function(s){ if (/["\\\x00-\x1f]/.test(s)) { return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = m[b]; if(c){ return c; } c = b.charCodeAt(); return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }) + '"'; } return '"' + s + '"'; }; var encodeArray = function(o){ var a = ["["], b, i, l = o.length, v; for (i = 0; i < l; i += 1) { v = o[i]; switch (typeof v) { case "undefined": case "function": case "unknown": break; default: if (b) { a.push(','); } a.push(v === null ? "null" : Ext.util.JSON.encode(v)); b = true; } } a.push("]"); return a.join(""); }; var encodeDate = function(o){ return '"' + o.getFullYear() + "-" + pad(o.getMonth() + 1) + "-" + pad(o.getDate()) + "T" + pad(o.getHours()) + ":" + pad(o.getMinutes()) + ":" + pad(o.getSeconds()) + '"'; }; this.encode = function(o){ if(typeof o == "undefined" || o === null){ return "null"; }else if(Ext.isArray(o)){ return encodeArray(o); }else if(Ext.isDate(o)){ return encodeDate(o); }else if(typeof o == "string"){ return encodeString(o); }else if(typeof o == "number"){ return isFinite(o) ? String(o) : "null"; }else if(typeof o == "boolean"){ return String(o); }else { var a = ["{"], b, i, v; for (i in o) { if(!useHasOwn || o.hasOwnProperty(i)) { v = o[i]; switch (typeof v) { case "undefined": case "function": case "unknown": break; default: if(b){ a.push(','); } a.push(this.encode(i), ":", v === null ? "null" : this.encode(v)); b = true; } } } a.push("}"); return a.join(""); } }; this.decode = function(json){ return eval("(" + json + ')'); }; })(); Ext.encode = Ext.util.JSON.encode; Ext.decode = Ext.util.JSON.decode; Ext.util.Format = function(){ var trimRe = /^\s+|\s+$/g; return { ellipsis : function(value, len){ if(value && value.length > len){ return value.substr(0, len-3)+"..."; } return value; }, undef : function(value){ return value !== undefined ? value : ""; }, defaultValue : function(value, defaultValue){ return value !== undefined && value !== '' ? value : defaultValue; }, htmlEncode : function(value){ return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;"); }, htmlDecode : function(value){ return !value ? value : String(value).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"'); }, trim : function(value){ return String(value).replace(trimRe, ""); }, substr : function(value, start, length){ return String(value).substr(start, length); }, lowercase : function(value){ return String(value).toLowerCase(); }, uppercase : function(value){ return String(value).toUpperCase(); }, capitalize : function(value){ return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase(); }, call : function(value, fn){ if(arguments.length > 2){ var args = Array.prototype.slice.call(arguments, 2); args.unshift(value); return eval(fn).apply(window, args); }else{ return eval(fn).call(window, value); } }, usMoney : function(v){ v = (Math.round((v-0)*100))/100; v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v); v = String(v); var ps = v.split('.'); var whole = ps[0]; var sub = ps[1] ? '.'+ ps[1] : '.00'; var r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; if(v.charAt(0) == '-'){ return '-$' + v.substr(1); } return "$" + v; }, date : function(v, format){ if(!v){ return ""; } if(!Ext.isDate(v)){ v = new Date(Date.parse(v)); } return v.dateFormat(format || "m/d/Y"); }, dateRenderer : function(format){ return function(v){ return Ext.util.Format.date(v, format); }; }, stripTagsRE : /<\/?[^>]+>/gi, stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); }, stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, stripScripts : function(v){ return !v ? v : String(v).replace(this.stripScriptsRe, ""); }, fileSize : function(size){ if(size < 1024) { return size + " bytes"; } else if(size < 1048576) { return (Math.round(((size*10) / 1024))/10) + " KB"; } else { return (Math.round(((size*10) / 1048576))/10) + " MB"; } }, math : function(){ var fns = {}; return function(v, a){ if(!fns[a]){ fns[a] = new Function('v', 'return v ' + a + ';'); } return fns[a](v); } }() }; }(); Ext.XTemplate = function(){ Ext.XTemplate.superclass.constructor.apply(this, arguments); var s = this.html; s = ['<tpl>', s, '</tpl>'].join(''); var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/; var nameRe = /^<tpl\b[^>]*?for="(.*?)"/; var ifRe = /^<tpl\b[^>]*?if="(.*?)"/; var execRe = /^<tpl\b[^>]*?exec="(.*?)"/; var m, id = 0; var tpls = []; while(m = s.match(re)){ var m2 = m[0].match(nameRe); var m3 = m[0].match(ifRe); var m4 = m[0].match(execRe); var exp = null, fn = null, exec = null; var name = m2 && m2[1] ? m2[1] : ''; if(m3){ exp = m3 && m3[1] ? m3[1] : null; if(exp){ fn = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }'); } } if(m4){ exp = m4 && m4[1] ? m4[1] : null; if(exp){ exec = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }'); } } if(name){ switch(name){ case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break; case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break; default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }'); } } tpls.push({ id: id, target: name, exec: exec, test: fn, body: m[1]||'' }); s = s.replace(m[0], '{xtpl'+ id + '}'); ++id; } for(var i = tpls.length-1; i >= 0; --i){ this.compileTpl(tpls[i]); } this.master = tpls[tpls.length-1]; this.tpls = tpls; }; Ext.extend(Ext.XTemplate, Ext.Template, { re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g, codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g, applySubTemplate : function(id, values, parent, xindex, xcount){ var t = this.tpls[id]; if(t.test && !t.test.call(this, values, parent, xindex, xcount)){ return ''; } if(t.exec && t.exec.call(this, values, parent, xindex, xcount)){ return ''; } var vs = t.target ? t.target.call(this, values, parent) : values; parent = t.target ? values : parent; if(t.target && Ext.isArray(vs)){ var buf = []; for(var i = 0, len = vs.length; i < len; i++){ buf[buf.length] = t.compiled.call(this, vs[i], parent, i+1, len); } return buf.join(''); } return t.compiled.call(this, vs, parent, xindex, xcount); }, compileTpl : function(tpl){ var fm = Ext.util.Format; var useF = this.disableFormats !== true; var sep = Ext.isGecko ? "+" : ","; var fn = function(m, name, format, args, math){ if(name.substr(0, 4) == 'xtpl'){ return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'"; } var v; if(name === '.'){ v = 'values'; }else if(name === '#'){ v = 'xindex'; }else if(name.indexOf('.') != -1){ v = name; }else{ v = "values['" + name + "']"; } if(math){ v = '(' + v + math + ')'; } if(format && useF){ args = args ? ',' + args : ""; if(format.substr(0, 5) != "this."){ format = "fm." + format + '('; }else{ format = 'this.call("'+ format.substr(5) + '", '; args = ", values"; } }else{ args= ''; format = "("+v+" === undefined ? '' : "; } return "'"+ sep + format + v + args + ")"+sep+"'"; }; var codeFn = function(m, code){ return "'"+ sep +'('+code+')'+sep+"'"; }; var body; if(Ext.isGecko){ body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" + tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) + "';};"; }else{ body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"]; body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn)); body.push("'].join('');};"); body = body.join(''); } eval(body); return this; }, apply : function(values){ return this.master.compiled.call(this, values, {}, 1, 1); }, applyTemplate : function(values){ return this.master.compiled.call(this, values, {}, 1, 1); }, compile : function(){return this;} }); Ext.XTemplate.from = function(el){ el = Ext.getDom(el); return new Ext.XTemplate(el.value || el.innerHTML); }; Ext.util.CSS = function(){ var rules = null; var doc = document; var camelRe = /(-[a-z])/gi; var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); }; return { createStyleSheet : function(cssText, id){ var ss; var head = doc.getElementsByTagName("head")[0]; var rules = doc.createElement("style"); rules.setAttribute("type", "text/css"); if(id){ rules.setAttribute("id", id); } if(Ext.isIE){ head.appendChild(rules); ss = rules.styleSheet; ss.cssText = cssText; }else{ try{ rules.appendChild(doc.createTextNode(cssText)); }catch(e){ rules.cssText = cssText; } head.appendChild(rules); ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]); } this.cacheStyleSheet(ss); return ss; }, removeStyleSheet : function(id){ var existing = doc.getElementById(id); if(existing){ existing.parentNode.removeChild(existing); } }, swapStyleSheet : function(id, url){ this.removeStyleSheet(id); var ss = doc.createElement("link"); ss.setAttribute("rel", "stylesheet"); ss.setAttribute("type", "text/css"); ss.setAttribute("id", id); ss.setAttribute("href", url); doc.getElementsByTagName("head")[0].appendChild(ss); }, refreshCache : function(){ return this.getRules(true); }, cacheStyleSheet : function(ss){ if(!rules){ rules = {}; } try{ var ssRules = ss.cssRules || ss.rules; for(var j = ssRules.length-1; j >= 0; --j){ rules[ssRules[j].selectorText] = ssRules[j]; } }catch(e){} }, getRules : function(refreshCache){ if(rules == null || refreshCache){ rules = {}; var ds = doc.styleSheets; for(var i =0, len = ds.length; i < len; i++){ try{ this.cacheStyleSheet(ds[i]); }catch(e){} } } return rules; }, getRule : function(selector, refreshCache){ var rs = this.getRules(refreshCache); if(!Ext.isArray(selector)){ return rs[selector]; } for(var i = 0; i < selector.length; i++){ if(rs[selector[i]]){ return rs[selector[i]]; } } return null; }, updateRule : function(selector, property, value){ if(!Ext.isArray(selector)){ var rule = this.getRule(selector); if(rule){ rule.style[property.replace(camelRe, camelFn)] = value; return true; } }else{ for(var i = 0; i < selector.length; i++){ if(this.updateRule(selector[i], property, value)){ return true; } } } return false; } }; }(); Ext.util.ClickRepeater = function(el, config) { this.el = Ext.get(el); this.el.unselectable(); Ext.apply(this, config); this.addEvents( "mousedown", "click", "mouseup" ); this.el.on("mousedown", this.handleMouseDown, this); if(this.preventDefault || this.stopDefault){ this.el.on("click", function(e){ if(this.preventDefault){ e.preventDefault(); } if(this.stopDefault){ e.stopEvent(); } }, this); } if(this.handler){ this.on("click", this.handler, this.scope || this); } Ext.util.ClickRepeater.superclass.constructor.call(this); }; Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, { interval : 20, delay: 250, preventDefault : true, stopDefault : false, timer : 0, handleMouseDown : function(){ clearTimeout(this.timer); this.el.blur(); if(this.pressClass){ this.el.addClass(this.pressClass); } this.mousedownTime = new Date(); Ext.getDoc().on("mouseup", this.handleMouseUp, this); this.el.on("mouseout", this.handleMouseOut, this); this.fireEvent("mousedown", this); this.fireEvent("click", this); if (this.accelerate) { this.delay = 400; } this.timer = this.click.defer(this.delay || this.interval, this); }, click : function(){ this.fireEvent("click", this); this.timer = this.click.defer(this.accelerate ? this.easeOutExpo(this.mousedownTime.getElapsed(), 400, -390, 12000) : this.interval, this); }, easeOutExpo : function (t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, handleMouseOut : function(){ clearTimeout(this.timer); if(this.pressClass){ this.el.removeClass(this.pressClass); } this.el.on("mouseover", this.handleMouseReturn, this); }, handleMouseReturn : function(){ this.el.un("mouseover", this.handleMouseReturn); if(this.pressClass){ this.el.addClass(this.pressClass); } this.click(); }, handleMouseUp : function(){ clearTimeout(this.timer); this.el.un("mouseover", this.handleMouseReturn); this.el.un("mouseout", this.handleMouseOut); Ext.getDoc().un("mouseup", this.handleMouseUp); this.el.removeClass(this.pressClass); this.fireEvent("mouseup", this); } }); Ext.KeyNav = function(el, config){ this.el = Ext.get(el); Ext.apply(this, config); if(!this.disabled){ this.disabled = true; this.enable(); } }; Ext.KeyNav.prototype = { disabled : false, defaultEventAction: "stopEvent", forceKeyDown : false, prepareEvent : function(e){ var k = e.getKey(); var h = this.keyToHandler[k]; if(Ext.isSafari && h && k >= 37 && k <= 40){ e.stopEvent(); } }, relay : function(e){ var k = e.getKey(); var h = this.keyToHandler[k]; if(h && this[h]){ if(this.doRelay(e, this[h], h) !== true){ e[this.defaultEventAction](); } } }, doRelay : function(e, h, hname){ return h.call(this.scope || this, e); }, enter : false, left : false, right : false, up : false, down : false, tab : false, esc : false, pageUp : false, pageDown : false, del : false, home : false, end : false, keyToHandler : { 37 : "left", 39 : "right", 38 : "up", 40 : "down", 33 : "pageUp", 34 : "pageDown", 46 : "del", 36 : "home", 35 : "end", 13 : "enter", 27 : "esc", 9 : "tab" }, enable: function(){ if(this.disabled){ if(this.forceKeyDown || Ext.isIE || Ext.isAir){ this.el.on("keydown", this.relay, this); }else{ this.el.on("keydown", this.prepareEvent, this); this.el.on("keypress", this.relay, this); } this.disabled = false; } }, disable: function(){ if(!this.disabled){ if(this.forceKeyDown || Ext.isIE || Ext.isAir){ this.el.un("keydown", this.relay); }else{ this.el.un("keydown", this.prepareEvent); this.el.un("keypress", this.relay); } this.disabled = true; } } }; Ext.KeyMap = function(el, config, eventName){ this.el = Ext.get(el); this.eventName = eventName || "keydown"; this.bindings = []; if(config){ this.addBinding(config); } this.enable(); }; Ext.KeyMap.prototype = { stopEvent : false, addBinding : function(config){ if(Ext.isArray(config)){ for(var i = 0, len = config.length; i < len; i++){ this.addBinding(config[i]); } return; } var keyCode = config.key, shift = config.shift, ctrl = config.ctrl, alt = config.alt, fn = config.fn || config.handler, scope = config.scope; if(typeof keyCode == "string"){ var ks = []; var keyString = keyCode.toUpperCase(); for(var j = 0, len = keyString.length; j < len; j++){ ks.push(keyString.charCodeAt(j)); } keyCode = ks; } var keyArray = Ext.isArray(keyCode); var handler = function(e){ if((!shift || e.shiftKey) && (!ctrl || e.ctrlKey) && (!alt || e.altKey)){ var k = e.getKey(); if(keyArray){ for(var i = 0, len = keyCode.length; i < len; i++){ if(keyCode[i] == k){ if(this.stopEvent){ e.stopEvent(); } fn.call(scope || window, k, e); return; } } }else{ if(k == keyCode){ if(this.stopEvent){ e.stopEvent(); } fn.call(scope || window, k, e); } } } }; this.bindings.push(handler); }, on : function(key, fn, scope){ var keyCode, shift, ctrl, alt; if(typeof key == "object" && !Ext.isArray(key)){ keyCode = key.key; shift = key.shift; ctrl = key.ctrl; alt = key.alt; }else{ keyCode = key; } this.addBinding({ key: keyCode, shift: shift, ctrl: ctrl, alt: alt, fn: fn, scope: scope }) }, handleKeyDown : function(e){ if(this.enabled){ var b = this.bindings; for(var i = 0, len = b.length; i < len; i++){ b[i].call(this, e); } } }, isEnabled : function(){ return this.enabled; }, enable: function(){ if(!this.enabled){ this.el.on(this.eventName, this.handleKeyDown, this); this.enabled = true; } }, disable: function(){ if(this.enabled){ this.el.removeListener(this.eventName, this.handleKeyDown, this); this.enabled = false; } } }; Ext.util.TextMetrics = function(){ var shared; return { measure : function(el, text, fixedWidth){ if(!shared){ shared = Ext.util.TextMetrics.Instance(el, fixedWidth); } shared.bind(el); shared.setFixedWidth(fixedWidth || 'auto'); return shared.getSize(text); }, createInstance : function(el, fixedWidth){ return Ext.util.TextMetrics.Instance(el, fixedWidth); } }; }(); Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){ var ml = new Ext.Element(document.createElement('div')); document.body.appendChild(ml.dom); ml.position('absolute'); ml.setLeftTop(-1000, -1000); ml.hide(); if(fixedWidth){ ml.setWidth(fixedWidth); } var instance = { getSize : function(text){ ml.update(text); var s = ml.getSize(); ml.update(''); return s; }, bind : function(el){ ml.setStyle( Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height') ); }, setFixedWidth : function(width){ ml.setWidth(width); }, getWidth : function(text){ ml.dom.style.width = 'auto'; return this.getSize(text).width; }, getHeight : function(text){ return this.getSize(text).height; } }; instance.bind(bindTo); return instance; }; Ext.Element.measureText = Ext.util.TextMetrics.measure; (function() { var Event=Ext.EventManager; var Dom=Ext.lib.Dom; Ext.dd.DragDrop = function(id, sGroup, config) { if(id) { this.init(id, sGroup, config); } }; Ext.dd.DragDrop.prototype = { id: null, config: null, dragElId: null, handleElId: null, invalidHandleTypes: null, invalidHandleIds: null, invalidHandleClasses: null, startPageX: 0, startPageY: 0, groups: null, locked: false, lock: function() { this.locked = true; }, unlock: function() { this.locked = false; }, isTarget: true, padding: null, _domRef: null, __ygDragDrop: true, constrainX: false, constrainY: false, minX: 0, maxX: 0, minY: 0, maxY: 0, maintainOffset: false, xTicks: null, yTicks: null, primaryButtonOnly: true, available: false, hasOuterHandles: false, b4StartDrag: function(x, y) { }, startDrag: function(x, y) { }, b4Drag: function(e) { }, onDrag: function(e) { }, onDragEnter: function(e, id) { }, b4DragOver: function(e) { }, onDragOver: function(e, id) { }, b4DragOut: function(e) { }, onDragOut: function(e, id) { }, b4DragDrop: function(e) { }, onDragDrop: function(e, id) { }, onInvalidDrop: function(e) { }, b4EndDrag: function(e) { }, endDrag: function(e) { }, b4MouseDown: function(e) { }, onMouseDown: function(e) { }, onMouseUp: function(e) { }, onAvailable: function () { }, defaultPadding : {left:0, right:0, top:0, bottom:0}, constrainTo : function(constrainTo, pad, inContent){ if(typeof pad == "number"){ pad = {left: pad, right:pad, top:pad, bottom:pad}; } pad = pad || this.defaultPadding; var b = Ext.get(this.getEl()).getBox(); var ce = Ext.get(constrainTo); var s = ce.getScroll(); var c, cd = ce.dom; if(cd == document.body){ c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()}; }else{ var xy = ce.getXY(); c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight}; } var topSpace = b.y - c.y; var leftSpace = b.x - c.x; this.resetConstraints(); this.setXConstraint(leftSpace - (pad.left||0), c.width - leftSpace - b.width - (pad.right||0), this.xTickSize ); this.setYConstraint(topSpace - (pad.top||0), c.height - topSpace - b.height - (pad.bottom||0), this.yTickSize ); }, getEl: function() { if (!this._domRef) { this._domRef = Ext.getDom(this.id); } return this._domRef; }, getDragEl: function() { return Ext.getDom(this.dragElId); }, init: function(id, sGroup, config) { this.initTarget(id, sGroup, config); Event.on(this.id, "mousedown", this.handleMouseDown, this); }, initTarget: function(id, sGroup, config) { this.config = config || {}; this.DDM = Ext.dd.DDM; this.groups = {}; if (typeof id !== "string") { id = Ext.id(id); } this.id = id; this.addToGroup((sGroup) ? sGroup : "default"); this.handleElId = id; this.setDragElId(id); this.invalidHandleTypes = { A: "A" }; this.invalidHandleIds = {}; this.invalidHandleClasses = []; this.applyConfig(); this.handleOnAvailable(); }, applyConfig: function() { this.padding = this.config.padding || [0, 0, 0, 0]; this.isTarget = (this.config.isTarget !== false); this.maintainOffset = (this.config.maintainOffset); this.primaryButtonOnly = (this.config.primaryButtonOnly !== false); }, handleOnAvailable: function() { this.available = true; this.resetConstraints(); this.onAvailable(); }, setPadding: function(iTop, iRight, iBot, iLeft) { if (!iRight && 0 !== iRight) { this.padding = [iTop, iTop, iTop, iTop]; } else if (!iBot && 0 !== iBot) { this.padding = [iTop, iRight, iTop, iRight]; } else { this.padding = [iTop, iRight, iBot, iLeft]; } }, setInitPosition: function(diffX, diffY) { var el = this.getEl(); if (!this.DDM.verifyEl(el)) { return; } var dx = diffX || 0; var dy = diffY || 0; var p = Dom.getXY( el ); this.initPageX = p[0] - dx; this.initPageY = p[1] - dy; this.lastPageX = p[0]; this.lastPageY = p[1]; this.setStartPosition(p); }, setStartPosition: function(pos) { var p = pos || Dom.getXY( this.getEl() ); this.deltaSetXY = null; this.startPageX = p[0]; this.startPageY = p[1]; }, addToGroup: function(sGroup) { this.groups[sGroup] = true; this.DDM.regDragDrop(this, sGroup); }, removeFromGroup: function(sGroup) { if (this.groups[sGroup]) { delete this.groups[sGroup]; } this.DDM.removeDDFromGroup(this, sGroup); }, setDragElId: function(id) { this.dragElId = id; }, setHandleElId: function(id) { if (typeof id !== "string") { id = Ext.id(id); } this.handleElId = id; this.DDM.regHandle(this.id, id); }, setOuterHandleElId: function(id) { if (typeof id !== "string") { id = Ext.id(id); } Event.on(id, "mousedown", this.handleMouseDown, this); this.setHandleElId(id); this.hasOuterHandles = true; }, unreg: function() { Event.un(this.id, "mousedown", this.handleMouseDown); this._domRef = null; this.DDM._remove(this); }, destroy : function(){ this.unreg(); }, isLocked: function() { return (this.DDM.isLocked() || this.locked); }, handleMouseDown: function(e, oDD){ if (this.primaryButtonOnly && e.button != 0) { return; } if (this.isLocked()) { return; } this.DDM.refreshCache(this.groups); var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e)); if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) { } else { if (this.clickValidator(e)) { this.setStartPosition(); this.b4MouseDown(e); this.onMouseDown(e); this.DDM.handleMouseDown(e, this); this.DDM.stopEvent(e); } else { } } }, clickValidator: function(e) { var target = e.getTarget(); return ( this.isValidHandleChild(target) && (this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) ); }, addInvalidHandleType: function(tagName) { var type = tagName.toUpperCase(); this.invalidHandleTypes[type] = type; }, addInvalidHandleId: function(id) { if (typeof id !== "string") { id = Ext.id(id); } this.invalidHandleIds[id] = id; }, addInvalidHandleClass: function(cssClass) { this.invalidHandleClasses.push(cssClass); }, removeInvalidHandleType: function(tagName) { var type = tagName.toUpperCase(); delete this.invalidHandleTypes[type]; }, removeInvalidHandleId: function(id) { if (typeof id !== "string") { id = Ext.id(id); } delete this.invalidHandleIds[id]; }, removeInvalidHandleClass: function(cssClass) { for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) { if (this.invalidHandleClasses[i] == cssClass) { delete this.invalidHandleClasses[i]; } } }, isValidHandleChild: function(node) { var valid = true; var nodeName; try { nodeName = node.nodeName.toUpperCase(); } catch(e) { nodeName = node.nodeName; } valid = valid && !this.invalidHandleTypes[nodeName]; valid = valid && !this.invalidHandleIds[node.id]; for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) { valid = !Dom.hasClass(node, this.invalidHandleClasses[i]); } return valid; }, setXTicks: function(iStartX, iTickSize) { this.xTicks = []; this.xTickSize = iTickSize; var tickMap = {}; for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) { if (!tickMap[i]) { this.xTicks[this.xTicks.length] = i; tickMap[i] = true; } } for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) { if (!tickMap[i]) { this.xTicks[this.xTicks.length] = i; tickMap[i] = true; } } this.xTicks.sort(this.DDM.numericSort) ; }, setYTicks: function(iStartY, iTickSize) { this.yTicks = []; this.yTickSize = iTickSize; var tickMap = {}; for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) { if (!tickMap[i]) { this.yTicks[this.yTicks.length] = i; tickMap[i] = true; } } for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) { if (!tickMap[i]) { this.yTicks[this.yTicks.length] = i; tickMap[i] = true; } } this.yTicks.sort(this.DDM.numericSort) ; }, setXConstraint: function(iLeft, iRight, iTickSize) { this.leftConstraint = iLeft; this.rightConstraint = iRight; this.minX = this.initPageX - iLeft; this.maxX = this.initPageX + iRight; if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); } this.constrainX = true; }, clearConstraints: function() { this.constrainX = false; this.constrainY = false; this.clearTicks(); }, clearTicks: function() { this.xTicks = null; this.yTicks = null; this.xTickSize = 0; this.yTickSize = 0; }, setYConstraint: function(iUp, iDown, iTickSize) { this.topConstraint = iUp; this.bottomConstraint = iDown; this.minY = this.initPageY - iUp; this.maxY = this.initPageY + iDown; if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); } this.constrainY = true; }, resetConstraints: function() { if (this.initPageX || this.initPageX === 0) { var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0; var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0; this.setInitPosition(dx, dy); } else { this.setInitPosition(); } if (this.constrainX) { this.setXConstraint( this.leftConstraint, this.rightConstraint, this.xTickSize ); } if (this.constrainY) { this.setYConstraint( this.topConstraint, this.bottomConstraint, this.yTickSize ); } }, getTick: function(val, tickArray) { if (!tickArray) { return val; } else if (tickArray[0] >= val) { return tickArray[0]; } else { for (var i=0, len=tickArray.length; i<len; ++i) { var next = i + 1; if (tickArray[next] && tickArray[next] >= val) { var diff1 = val - tickArray[i]; var diff2 = tickArray[next] - val; return (diff2 > diff1) ? tickArray[i] : tickArray[next]; } } return tickArray[tickArray.length - 1]; } }, toString: function() { return ("DragDrop " + this.id); } }; })(); if (!Ext.dd.DragDropMgr) { Ext.dd.DragDropMgr = function() { var Event = Ext.EventManager; return { ids: {}, handleIds: {}, dragCurrent: null, dragOvers: {}, deltaX: 0, deltaY: 0, preventDefault: true, stopPropagation: true, initalized: false, locked: false, init: function() { this.initialized = true; }, POINT: 0, INTERSECT: 1, mode: 0, _execOnAll: function(sMethod, args) { for (var i in this.ids) { for (var j in this.ids[i]) { var oDD = this.ids[i][j]; if (! this.isTypeOfDD(oDD)) { continue; } oDD[sMethod].apply(oDD, args); } } }, _onLoad: function() { this.init(); Event.on(document, "mouseup", this.handleMouseUp, this, true); Event.on(document, "mousemove", this.handleMouseMove, this, true); Event.on(window, "unload", this._onUnload, this, true); Event.on(window, "resize", this._onResize, this, true); }, _onResize: function(e) { this._execOnAll("resetConstraints", []); }, lock: function() { this.locked = true; }, unlock: function() { this.locked = false; }, isLocked: function() { return this.locked; }, locationCache: {}, useCache: true, clickPixelThresh: 3, clickTimeThresh: 350, dragThreshMet: false, clickTimeout: null, startX: 0, startY: 0, regDragDrop: function(oDD, sGroup) { if (!this.initialized) { this.init(); } if (!this.ids[sGroup]) { this.ids[sGroup] = {}; } this.ids[sGroup][oDD.id] = oDD; }, removeDDFromGroup: function(oDD, sGroup) { if (!this.ids[sGroup]) { this.ids[sGroup] = {}; } var obj = this.ids[sGroup]; if (obj && obj[oDD.id]) { delete obj[oDD.id]; } }, _remove: function(oDD) { for (var g in oDD.groups) { if (g && this.ids[g][oDD.id]) { delete this.ids[g][oDD.id]; } } delete this.handleIds[oDD.id]; }, regHandle: function(sDDId, sHandleId) { if (!this.handleIds[sDDId]) { this.handleIds[sDDId] = {}; } this.handleIds[sDDId][sHandleId] = sHandleId; }, isDragDrop: function(id) { return ( this.getDDById(id) ) ? true : false; }, getRelated: function(p_oDD, bTargetsOnly) { var oDDs = []; for (var i in p_oDD.groups) { for (j in this.ids[i]) { var dd = this.ids[i][j]; if (! this.isTypeOfDD(dd)) { continue; } if (!bTargetsOnly || dd.isTarget) { oDDs[oDDs.length] = dd; } } } return oDDs; }, isLegalTarget: function (oDD, oTargetDD) { var targets = this.getRelated(oDD, true); for (var i=0, len=targets.length;i<len;++i) { if (targets[i].id == oTargetDD.id) { return true; } } return false; }, isTypeOfDD: function (oDD) { return (oDD && oDD.__ygDragDrop); }, isHandle: function(sDDId, sHandleId) { return ( this.handleIds[sDDId] && this.handleIds[sDDId][sHandleId] ); }, getDDById: function(id) { for (var i in this.ids) { if (this.ids[i][id]) { return this.ids[i][id]; } } return null; }, handleMouseDown: function(e, oDD) { if(Ext.QuickTips){ Ext.QuickTips.disable(); } this.currentTarget = e.getTarget(); this.dragCurrent = oDD; var el = oDD.getEl(); this.startX = e.getPageX(); this.startY = e.getPageY(); this.deltaX = this.startX - el.offsetLeft; this.deltaY = this.startY - el.offsetTop; this.dragThreshMet = false; this.clickTimeout = setTimeout( function() { var DDM = Ext.dd.DDM; DDM.startDrag(DDM.startX, DDM.startY); }, this.clickTimeThresh ); }, startDrag: function(x, y) { clearTimeout(this.clickTimeout); if (this.dragCurrent) { this.dragCurrent.b4StartDrag(x, y); this.dragCurrent.startDrag(x, y); } this.dragThreshMet = true; }, handleMouseUp: function(e) { if(Ext.QuickTips){ Ext.QuickTips.enable(); } if (! this.dragCurrent) { return; } clearTimeout(this.clickTimeout); if (this.dragThreshMet) { this.fireEvents(e, true); } else { } this.stopDrag(e); this.stopEvent(e); }, stopEvent: function(e){ if(this.stopPropagation) { e.stopPropagation(); } if (this.preventDefault) { e.preventDefault(); } }, stopDrag: function(e) { if (this.dragCurrent) { if (this.dragThreshMet) { this.dragCurrent.b4EndDrag(e); this.dragCurrent.endDrag(e); } this.dragCurrent.onMouseUp(e); } this.dragCurrent = null; this.dragOvers = {}; }, handleMouseMove: function(e) { if (! this.dragCurrent) { return true; } if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) { this.stopEvent(e); return this.handleMouseUp(e); } if (!this.dragThreshMet) { var diffX = Math.abs(this.startX - e.getPageX()); var diffY = Math.abs(this.startY - e.getPageY()); if (diffX > this.clickPixelThresh || diffY > this.clickPixelThresh) { this.startDrag(this.startX, this.startY); } } if (this.dragThreshMet) { this.dragCurrent.b4Drag(e); this.dragCurrent.onDrag(e); if(!this.dragCurrent.moveOnly){ this.fireEvents(e, false); } } this.stopEvent(e); return true; }, fireEvents: function(e, isDrop) { var dc = this.dragCurrent; if (!dc || dc.isLocked()) { return; } var pt = e.getPoint(); var oldOvers = []; var outEvts = []; var overEvts = []; var dropEvts = []; var enterEvts = []; for (var i in this.dragOvers) { var ddo = this.dragOvers[i]; if (! this.isTypeOfDD(ddo)) { continue; } if (! this.isOverTarget(pt, ddo, this.mode)) { outEvts.push( ddo ); } oldOvers[i] = true; delete this.dragOvers[i]; } for (var sGroup in dc.groups) { if ("string" != typeof sGroup) { continue; } for (i in this.ids[sGroup]) { var oDD = this.ids[sGroup][i]; if (! this.isTypeOfDD(oDD)) { continue; } if (oDD.isTarget && !oDD.isLocked() && oDD != dc) { if (this.isOverTarget(pt, oDD, this.mode)) { if (isDrop) { dropEvts.push( oDD ); } else { if (!oldOvers[oDD.id]) { enterEvts.push( oDD ); } else { overEvts.push( oDD ); } this.dragOvers[oDD.id] = oDD; } } } } } if (this.mode) { if (outEvts.length) { dc.b4DragOut(e, outEvts); dc.onDragOut(e, outEvts); } if (enterEvts.length) { dc.onDragEnter(e, enterEvts); } if (overEvts.length) { dc.b4DragOver(e, overEvts); dc.onDragOver(e, overEvts); } if (dropEvts.length) { dc.b4DragDrop(e, dropEvts); dc.onDragDrop(e, dropEvts); } } else { var len = 0; for (i=0, len=outEvts.length; i<len; ++i) { dc.b4DragOut(e, outEvts[i].id); dc.onDragOut(e, outEvts[i].id); } for (i=0,len=enterEvts.length; i<len; ++i) { dc.onDragEnter(e, enterEvts[i].id); } for (i=0,len=overEvts.length; i<len; ++i) { dc.b4DragOver(e, overEvts[i].id); dc.onDragOver(e, overEvts[i].id); } for (i=0, len=dropEvts.length; i<len; ++i) { dc.b4DragDrop(e, dropEvts[i].id); dc.onDragDrop(e, dropEvts[i].id); } } if (isDrop && !dropEvts.length) { dc.onInvalidDrop(e); } }, getBestMatch: function(dds) { var winner = null; var len = dds.length; if (len == 1) { winner = dds[0]; } else { for (var i=0; i<len; ++i) { var dd = dds[i]; if (dd.cursorIsOver) { winner = dd; break; } else { if (!winner || winner.overlap.getArea() < dd.overlap.getArea()) { winner = dd; } } } } return winner; }, refreshCache: function(groups) { for (var sGroup in groups) { if ("string" != typeof sGroup) { continue; } for (var i in this.ids[sGroup]) { var oDD = this.ids[sGroup][i]; if (this.isTypeOfDD(oDD)) { var loc = this.getLocation(oDD); if (loc) { this.locationCache[oDD.id] = loc; } else { delete this.locationCache[oDD.id]; } } } } }, verifyEl: function(el) { if (el) { var parent; if(Ext.isIE){ try{ parent = el.offsetParent; }catch(e){} }else{ parent = el.offsetParent; } if (parent) { return true; } } return false; }, getLocation: function(oDD) { if (! this.isTypeOfDD(oDD)) { return null; } var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l; try { pos= Ext.lib.Dom.getXY(el); } catch (e) { } if (!pos) { return null; } x1 = pos[0]; x2 = x1 + el.offsetWidth; y1 = pos[1]; y2 = y1 + el.offsetHeight; t = y1 - oDD.padding[0]; r = x2 + oDD.padding[1]; b = y2 + oDD.padding[2]; l = x1 - oDD.padding[3]; return new Ext.lib.Region( t, r, b, l ); }, isOverTarget: function(pt, oTarget, intersect) { var loc = this.locationCache[oTarget.id]; if (!loc || !this.useCache) { loc = this.getLocation(oTarget); this.locationCache[oTarget.id] = loc; } if (!loc) { return false; } oTarget.cursorIsOver = loc.contains( pt ); var dc = this.dragCurrent; if (!dc || !dc.getTargetCoord || (!intersect && !dc.constrainX && !dc.constrainY)) { return oTarget.cursorIsOver; } oTarget.overlap = null; var pos = dc.getTargetCoord(pt.x, pt.y); var el = dc.getDragEl(); var curRegion = new Ext.lib.Region( pos.y, pos.x + el.offsetWidth, pos.y + el.offsetHeight, pos.x ); var overlap = curRegion.intersect(loc); if (overlap) { oTarget.overlap = overlap; return (intersect) ? true : oTarget.cursorIsOver; } else { return false; } }, _onUnload: function(e, me) { Ext.dd.DragDropMgr.unregAll(); }, unregAll: function() { if (this.dragCurrent) { this.stopDrag(); this.dragCurrent = null; } this._execOnAll("unreg", []); for (var i in this.elementCache) { delete this.elementCache[i]; } this.elementCache = {}; this.ids = {}; }, elementCache: {}, getElWrapper: function(id) { var oWrapper = this.elementCache[id]; if (!oWrapper || !oWrapper.el) { oWrapper = this.elementCache[id] = new this.ElementWrapper(Ext.getDom(id)); } return oWrapper; }, getElement: function(id) { return Ext.getDom(id); }, getCss: function(id) { var el = Ext.getDom(id); return (el) ? el.style : null; }, ElementWrapper: function(el) { this.el = el || null; this.id = this.el && el.id; this.css = this.el && el.style; }, getPosX: function(el) { return Ext.lib.Dom.getX(el); }, getPosY: function(el) { return Ext.lib.Dom.getY(el); }, swapNode: function(n1, n2) { if (n1.swapNode) { n1.swapNode(n2); } else { var p = n2.parentNode; var s = n2.nextSibling; if (s == n1) { p.insertBefore(n1, n2); } else if (n2 == n1.nextSibling) { p.insertBefore(n2, n1); } else { n1.parentNode.replaceChild(n2, n1); p.insertBefore(n1, s); } } }, getScroll: function () { var t, l, dde=document.documentElement, db=document.body; if (dde && (dde.scrollTop || dde.scrollLeft)) { t = dde.scrollTop; l = dde.scrollLeft; } else if (db) { t = db.scrollTop; l = db.scrollLeft; } else { } return { top: t, left: l }; }, getStyle: function(el, styleProp) { return Ext.fly(el).getStyle(styleProp); }, getScrollTop: function () { return this.getScroll().top; }, getScrollLeft: function () { return this.getScroll().left; }, moveToEl: function (moveEl, targetEl) { var aCoord = Ext.lib.Dom.getXY(targetEl); Ext.lib.Dom.setXY(moveEl, aCoord); }, numericSort: function(a, b) { return (a - b); }, _timeoutCount: 0, _addListeners: function() { var DDM = Ext.dd.DDM; if ( Ext.lib.Event && document ) { DDM._onLoad(); } else { if (DDM._timeoutCount > 2000) { } else { setTimeout(DDM._addListeners, 10); if (document && document.body) { DDM._timeoutCount += 1; } } } }, handleWasClicked: function(node, id) { if (this.isHandle(id, node.id)) { return true; } else { var p = node.parentNode; while (p) { if (this.isHandle(id, p.id)) { return true; } else { p = p.parentNode; } } } return false; } }; }(); Ext.dd.DDM = Ext.dd.DragDropMgr; Ext.dd.DDM._addListeners(); } Ext.dd.DD = function(id, sGroup, config) { if (id) { this.init(id, sGroup, config); } }; Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, { scroll: true, autoOffset: function(iPageX, iPageY) { var x = iPageX - this.startPageX; var y = iPageY - this.startPageY; this.setDelta(x, y); }, setDelta: function(iDeltaX, iDeltaY) { this.deltaX = iDeltaX; this.deltaY = iDeltaY; }, setDragElPos: function(iPageX, iPageY) { var el = this.getDragEl(); this.alignElWithMouse(el, iPageX, iPageY); }, alignElWithMouse: function(el, iPageX, iPageY) { var oCoord = this.getTargetCoord(iPageX, iPageY); var fly = el.dom ? el : Ext.fly(el, '_dd'); if (!this.deltaSetXY) { var aCoord = [oCoord.x, oCoord.y]; fly.setXY(aCoord); var newLeft = fly.getLeft(true); var newTop = fly.getTop(true); this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ]; } else { fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]); } this.cachePosition(oCoord.x, oCoord.y); this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); return oCoord; }, cachePosition: function(iPageX, iPageY) { if (iPageX) { this.lastPageX = iPageX; this.lastPageY = iPageY; } else { var aCoord = Ext.lib.Dom.getXY(this.getEl()); this.lastPageX = aCoord[0]; this.lastPageY = aCoord[1]; } }, autoScroll: function(x, y, h, w) { if (this.scroll) { var clientH = Ext.lib.Dom.getViewHeight(); var clientW = Ext.lib.Dom.getViewWidth(); var st = this.DDM.getScrollTop(); var sl = this.DDM.getScrollLeft(); var bot = h + y; var right = w + x; var toBot = (clientH + st - y - this.deltaY); var toRight = (clientW + sl - x - this.deltaX); var thresh = 40; var scrAmt = (document.all) ? 80 : 30; if ( bot > clientH && toBot < thresh ) { window.scrollTo(sl, st + scrAmt); } if ( y < st && st > 0 && y - st < thresh ) { window.scrollTo(sl, st - scrAmt); } if ( right > clientW && toRight < thresh ) { window.scrollTo(sl + scrAmt, st); } if ( x < sl && sl > 0 && x - sl < thresh ) { window.scrollTo(sl - scrAmt, st); } } }, getTargetCoord: function(iPageX, iPageY) { var x = iPageX - this.deltaX; var y = iPageY - this.deltaY; if (this.constrainX) { if (x < this.minX) { x = this.minX; } if (x > this.maxX) { x = this.maxX; } } if (this.constrainY) { if (y < this.minY) { y = this.minY; } if (y > this.maxY) { y = this.maxY; } } x = this.getTick(x, this.xTicks); y = this.getTick(y, this.yTicks); return {x:x, y:y}; }, applyConfig: function() { Ext.dd.DD.superclass.applyConfig.call(this); this.scroll = (this.config.scroll !== false); }, b4MouseDown: function(e) { this.autoOffset(e.getPageX(), e.getPageY()); }, b4Drag: function(e) { this.setDragElPos(e.getPageX(), e.getPageY()); }, toString: function() { return ("DD " + this.id); } }); Ext.dd.DDProxy = function(id, sGroup, config) { if (id) { this.init(id, sGroup, config); this.initFrame(); } }; Ext.dd.DDProxy.dragElId = "ygddfdiv"; Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, { resizeFrame: true, centerFrame: false, createFrame: function() { var self = this; var body = document.body; if (!body || !body.firstChild) { setTimeout( function() { self.createFrame(); }, 50 ); return; } var div = this.getDragEl(); if (!div) { div = document.createElement("div"); div.id = this.dragElId; var s = div.style; s.position = "absolute"; s.visibility = "hidden"; s.cursor = "move"; s.border = "2px solid #aaa"; s.zIndex = 999; body.insertBefore(div, body.firstChild); } }, initFrame: function() { this.createFrame(); }, applyConfig: function() { Ext.dd.DDProxy.superclass.applyConfig.call(this); this.resizeFrame = (this.config.resizeFrame !== false); this.centerFrame = (this.config.centerFrame); this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId); }, showFrame: function(iPageX, iPageY) { var el = this.getEl(); var dragEl = this.getDragEl(); var s = dragEl.style; this._resizeProxy(); if (this.centerFrame) { this.setDelta( Math.round(parseInt(s.width, 10)/2), Math.round(parseInt(s.height, 10)/2) ); } this.setDragElPos(iPageX, iPageY); Ext.fly(dragEl).show(); }, _resizeProxy: function() { if (this.resizeFrame) { var el = this.getEl(); Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight); } }, b4MouseDown: function(e) { var x = e.getPageX(); var y = e.getPageY(); this.autoOffset(x, y); this.setDragElPos(x, y); }, b4StartDrag: function(x, y) { this.showFrame(x, y); }, b4EndDrag: function(e) { Ext.fly(this.getDragEl()).hide(); }, endDrag: function(e) { var lel = this.getEl(); var del = this.getDragEl(); del.style.visibility = ""; this.beforeMove(); lel.style.visibility = "hidden"; Ext.dd.DDM.moveToEl(lel, del); del.style.visibility = "hidden"; lel.style.visibility = ""; this.afterDrag(); }, beforeMove : function(){ }, afterDrag : function(){ }, toString: function() { return ("DDProxy " + this.id); } }); Ext.dd.DDTarget = function(id, sGroup, config) { if (id) { this.initTarget(id, sGroup, config); } }; Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, { toString: function() { return ("DDTarget " + this.id); } }); Ext.dd.DragTracker = function(config){ Ext.apply(this, config); this.addEvents( 'mousedown', 'mouseup', 'mousemove', 'dragstart', 'dragend', 'drag' ); this.dragRegion = new Ext.lib.Region(0,0,0,0); if(this.el){ this.initEl(this.el); } } Ext.extend(Ext.dd.DragTracker, Ext.util.Observable, { active: false, tolerance: 5, autoStart: false, initEl: function(el){ this.el = Ext.get(el); el.on('mousedown', this.onMouseDown, this, this.delegate ? {delegate: this.delegate} : undefined); }, destroy : function(){ this.el.un('mousedown', this.onMouseDown, this); }, onMouseDown: function(e, target){ if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){ this.startXY = this.lastXY = e.getXY(); this.dragTarget = this.delegate ? target : this.el.dom; e.preventDefault(); var doc = Ext.getDoc(); doc.on('mouseup', this.onMouseUp, this); doc.on('mousemove', this.onMouseMove, this); doc.on('selectstart', this.stopSelect, this); if(this.autoStart){ this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this); } } }, onMouseMove: function(e, target){ e.preventDefault(); var xy = e.getXY(), s = this.startXY; this.lastXY = xy; if(!this.active){ if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){ this.triggerStart(); }else{ return; } } this.fireEvent('mousemove', this, e); this.onDrag(e); this.fireEvent('drag', this, e); }, onMouseUp: function(e){ var doc = Ext.getDoc(); doc.un('mousemove', this.onMouseMove, this); doc.un('mouseup', this.onMouseUp, this); doc.un('selectstart', this.stopSelect, this); e.preventDefault(); this.clearStart(); this.active = false; delete this.elRegion; this.fireEvent('mouseup', this, e); this.onEnd(e); this.fireEvent('dragend', this, e); }, triggerStart: function(isTimer){ this.clearStart(); this.active = true; this.onStart(this.startXY); this.fireEvent('dragstart', this, this.startXY); }, clearStart : function(){ if(this.timer){ clearTimeout(this.timer); delete this.timer; } }, stopSelect : function(e){ e.stopEvent(); return false; }, onBeforeStart : function(e){ }, onStart : function(xy){ }, onDrag : function(e){ }, onEnd : function(e){ }, getDragTarget : function(){ return this.dragTarget; }, getDragCt : function(){ return this.el; }, getXY : function(constrain){ return constrain ? this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY; }, getOffset : function(constrain){ var xy = this.getXY(constrain); var s = this.startXY; return [s[0]-xy[0], s[1]-xy[1]]; }, constrainModes: { 'point' : function(xy){ if(!this.elRegion){ this.elRegion = this.getDragCt().getRegion(); } var dr = this.dragRegion; dr.left = xy[0]; dr.top = xy[1]; dr.right = xy[0]; dr.bottom = xy[1]; dr.constrainTo(this.elRegion); return [dr.left, dr.top]; } } }); Ext.dd.ScrollManager = function(){ var ddm = Ext.dd.DragDropMgr; var els = {}; var dragEl = null; var proc = {}; var onStop = function(e){ dragEl = null; clearProc(); }; var triggerRefresh = function(){ if(ddm.dragCurrent){ ddm.refreshCache(ddm.dragCurrent.groups); } }; var doScroll = function(){ if(ddm.dragCurrent){ var dds = Ext.dd.ScrollManager; var inc = proc.el.ddScrollConfig ? proc.el.ddScrollConfig.increment : dds.increment; if(!dds.animate){ if(proc.el.scroll(proc.dir, inc)){ triggerRefresh(); } }else{ proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh); } } }; var clearProc = function(){ if(proc.id){ clearInterval(proc.id); } proc.id = 0; proc.el = null; proc.dir = ""; }; var startProc = function(el, dir){ clearProc(); proc.el = el; proc.dir = dir; proc.id = setInterval(doScroll, Ext.dd.ScrollManager.frequency); }; var onFire = function(e, isDrop){ if(isDrop || !ddm.dragCurrent){ return; } var dds = Ext.dd.ScrollManager; if(!dragEl || dragEl != ddm.dragCurrent){ dragEl = ddm.dragCurrent; dds.refreshCache(); } var xy = Ext.lib.Event.getXY(e); var pt = new Ext.lib.Point(xy[0], xy[1]); for(var id in els){ var el = els[id], r = el._region; var c = el.ddScrollConfig ? el.ddScrollConfig : dds; if(r && r.contains(pt) && el.isScrollable()){ if(r.bottom - pt.y <= c.vthresh){ if(proc.el != el){ startProc(el, "down"); } return; }else if(r.right - pt.x <= c.hthresh){ if(proc.el != el){ startProc(el, "left"); } return; }else if(pt.y - r.top <= c.vthresh){ if(proc.el != el){ startProc(el, "up"); } return; }else if(pt.x - r.left <= c.hthresh){ if(proc.el != el){ startProc(el, "right"); } return; } } } clearProc(); }; ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm); ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm); return { register : function(el){ if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++) { this.register(el[i]); } }else{ el = Ext.get(el); els[el.id] = el; } }, unregister : function(el){ if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++) { this.unregister(el[i]); } }else{ el = Ext.get(el); delete els[el.id]; } }, vthresh : 25, hthresh : 25, increment : 100, frequency : 500, animate: true, animDuration: .4, refreshCache : function(){ for(var id in els){ if(typeof els[id] == 'object'){ els[id]._region = els[id].getRegion(); } } } }; }(); Ext.dd.Registry = function(){ var elements = {}; var handles = {}; var autoIdSeed = 0; var getId = function(el, autogen){ if(typeof el == "string"){ return el; } var id = el.id; if(!id && autogen !== false){ id = "extdd-" + (++autoIdSeed); el.id = id; } return id; }; return { register : function(el, data){ data = data || {}; if(typeof el == "string"){ el = document.getElementById(el); } data.ddel = el; elements[getId(el)] = data; if(data.isHandle !== false){ handles[data.ddel.id] = data; } if(data.handles){ var hs = data.handles; for(var i = 0, len = hs.length; i < len; i++){ handles[getId(hs[i])] = data; } } }, unregister : function(el){ var id = getId(el, false); var data = elements[id]; if(data){ delete elements[id]; if(data.handles){ var hs = data.handles; for(var i = 0, len = hs.length; i < len; i++){ delete handles[getId(hs[i], false)]; } } } }, getHandle : function(id){ if(typeof id != "string"){ id = id.id; } return handles[id]; }, getHandleFromEvent : function(e){ var t = Ext.lib.Event.getTarget(e); return t ? handles[t.id] : null; }, getTarget : function(id){ if(typeof id != "string"){ id = id.id; } return elements[id]; }, getTargetFromEvent : function(e){ var t = Ext.lib.Event.getTarget(e); return t ? elements[t.id] || handles[t.id] : null; } }; }(); Ext.dd.StatusProxy = function(config){ Ext.apply(this, config); this.id = this.id || Ext.id(); this.el = new Ext.Layer({ dh: { id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [ {tag: "div", cls: "x-dd-drop-icon"}, {tag: "div", cls: "x-dd-drag-ghost"} ] }, shadow: !config || config.shadow !== false }); this.ghost = Ext.get(this.el.dom.childNodes[1]); this.dropStatus = this.dropNotAllowed; }; Ext.dd.StatusProxy.prototype = { dropAllowed : "x-dd-drop-ok", dropNotAllowed : "x-dd-drop-nodrop", setStatus : function(cssClass){ cssClass = cssClass || this.dropNotAllowed; if(this.dropStatus != cssClass){ this.el.replaceClass(this.dropStatus, cssClass); this.dropStatus = cssClass; } }, reset : function(clearGhost){ this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed; this.dropStatus = this.dropNotAllowed; if(clearGhost){ this.ghost.update(""); } }, update : function(html){ if(typeof html == "string"){ this.ghost.update(html); }else{ this.ghost.update(""); html.style.margin = "0"; this.ghost.dom.appendChild(html); } }, getEl : function(){ return this.el; }, getGhost : function(){ return this.ghost; }, hide : function(clear){ this.el.hide(); if(clear){ this.reset(true); } }, stop : function(){ if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){ this.anim.stop(); } }, show : function(){ this.el.show(); }, sync : function(){ this.el.sync(); }, repair : function(xy, callback, scope){ this.callback = callback; this.scope = scope; if(xy && this.animRepair !== false){ this.el.addClass("x-dd-drag-repair"); this.el.hideUnders(true); this.anim = this.el.shift({ duration: this.repairDuration || .5, easing: 'easeOut', xy: xy, stopFx: true, callback: this.afterRepair, scope: this }); }else{ this.afterRepair(); } }, afterRepair : function(){ this.hide(true); if(typeof this.callback == "function"){ this.callback.call(this.scope || this); } this.callback = null; this.scope = null; } }; Ext.dd.DragSource = function(el, config){ this.el = Ext.get(el); if(!this.dragData){ this.dragData = {}; } Ext.apply(this, config); if(!this.proxy){ this.proxy = new Ext.dd.StatusProxy(); } Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, {dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true}); this.dragging = false; }; Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, { dropAllowed : "x-dd-drop-ok", dropNotAllowed : "x-dd-drop-nodrop", getDragData : function(e){ return this.dragData; }, onDragEnter : function(e, id){ var target = Ext.dd.DragDropMgr.getDDById(id); this.cachedTarget = target; if(this.beforeDragEnter(target, e, id) !== false){ if(target.isNotifyTarget){ var status = target.notifyEnter(this, e, this.dragData); this.proxy.setStatus(status); }else{ this.proxy.setStatus(this.dropAllowed); } if(this.afterDragEnter){ this.afterDragEnter(target, e, id); } } }, beforeDragEnter : function(target, e, id){ return true; }, alignElWithMouse: function() { Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments); this.proxy.sync(); }, onDragOver : function(e, id){ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id); if(this.beforeDragOver(target, e, id) !== false){ if(target.isNotifyTarget){ var status = target.notifyOver(this, e, this.dragData); this.proxy.setStatus(status); } if(this.afterDragOver){ this.afterDragOver(target, e, id); } } }, beforeDragOver : function(target, e, id){ return true; }, onDragOut : function(e, id){ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id); if(this.beforeDragOut(target, e, id) !== false){ if(target.isNotifyTarget){ target.notifyOut(this, e, this.dragData); } this.proxy.reset(); if(this.afterDragOut){ this.afterDragOut(target, e, id); } } this.cachedTarget = null; }, beforeDragOut : function(target, e, id){ return true; }, onDragDrop : function(e, id){ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id); if(this.beforeDragDrop(target, e, id) !== false){ if(target.isNotifyTarget){ if(target.notifyDrop(this, e, this.dragData)){ this.onValidDrop(target, e, id); }else{ this.onInvalidDrop(target, e, id); } }else{ this.onValidDrop(target, e, id); } if(this.afterDragDrop){ this.afterDragDrop(target, e, id); } } delete this.cachedTarget; }, beforeDragDrop : function(target, e, id){ return true; }, onValidDrop : function(target, e, id){ this.hideProxy(); if(this.afterValidDrop){ this.afterValidDrop(target, e, id); } }, getRepairXY : function(e, data){ return this.el.getXY(); }, onInvalidDrop : function(target, e, id){ this.beforeInvalidDrop(target, e, id); if(this.cachedTarget){ if(this.cachedTarget.isNotifyTarget){ this.cachedTarget.notifyOut(this, e, this.dragData); } this.cacheTarget = null; } this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this); if(this.afterInvalidDrop){ this.afterInvalidDrop(e, id); } }, afterRepair : function(){ if(Ext.enableFx){ this.el.highlight(this.hlColor || "c3daf9"); } this.dragging = false; }, beforeInvalidDrop : function(target, e, id){ return true; }, handleMouseDown : function(e){ if(this.dragging) { return; } var data = this.getDragData(e); if(data && this.onBeforeDrag(data, e) !== false){ this.dragData = data; this.proxy.stop(); Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments); } }, onBeforeDrag : function(data, e){ return true; }, onStartDrag : Ext.emptyFn, startDrag : function(x, y){ this.proxy.reset(); this.dragging = true; this.proxy.update(""); this.onInitDrag(x, y); this.proxy.show(); }, onInitDrag : function(x, y){ var clone = this.el.dom.cloneNode(true); clone.id = Ext.id(); this.proxy.update(clone); this.onStartDrag(x, y); return true; }, getProxy : function(){ return this.proxy; }, hideProxy : function(){ this.proxy.hide(); this.proxy.reset(true); this.dragging = false; }, triggerCacheRefresh : function(){ Ext.dd.DDM.refreshCache(this.groups); }, b4EndDrag: function(e) { }, endDrag : function(e){ this.onEndDrag(this.dragData, e); }, onEndDrag : function(data, e){ }, autoOffset : function(x, y) { this.setDelta(-12, -20); } }); Ext.dd.DropTarget = function(el, config){ this.el = Ext.get(el); Ext.apply(this, config); if(this.containerScroll){ Ext.dd.ScrollManager.register(this.el); } Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, {isTarget: true}); }; Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, { dropAllowed : "x-dd-drop-ok", dropNotAllowed : "x-dd-drop-nodrop", isTarget : true, isNotifyTarget : true, notifyEnter : function(dd, e, data){ if(this.overClass){ this.el.addClass(this.overClass); } return this.dropAllowed; }, notifyOver : function(dd, e, data){ return this.dropAllowed; }, notifyOut : function(dd, e, data){ if(this.overClass){ this.el.removeClass(this.overClass); } }, notifyDrop : function(dd, e, data){ return false; } }); Ext.dd.DragZone = function(el, config){ Ext.dd.DragZone.superclass.constructor.call(this, el, config); if(this.containerScroll){ Ext.dd.ScrollManager.register(this.el); } }; Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, { getDragData : function(e){ return Ext.dd.Registry.getHandleFromEvent(e); }, onInitDrag : function(x, y){ this.proxy.update(this.dragData.ddel.cloneNode(true)); this.onStartDrag(x, y); return true; }, afterRepair : function(){ if(Ext.enableFx){ Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9"); } this.dragging = false; }, getRepairXY : function(e){ return Ext.Element.fly(this.dragData.ddel).getXY(); } }); Ext.dd.DropZone = function(el, config){ Ext.dd.DropZone.superclass.constructor.call(this, el, config); }; Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, { getTargetFromEvent : function(e){ return Ext.dd.Registry.getTargetFromEvent(e); }, onNodeEnter : function(n, dd, e, data){ }, onNodeOver : function(n, dd, e, data){ return this.dropAllowed; }, onNodeOut : function(n, dd, e, data){ }, onNodeDrop : function(n, dd, e, data){ return false; }, onContainerOver : function(dd, e, data){ return this.dropNotAllowed; }, onContainerDrop : function(dd, e, data){ return false; }, notifyEnter : function(dd, e, data){ return this.dropNotAllowed; }, notifyOver : function(dd, e, data){ var n = this.getTargetFromEvent(e); if(!n){ if(this.lastOverNode){ this.onNodeOut(this.lastOverNode, dd, e, data); this.lastOverNode = null; } return this.onContainerOver(dd, e, data); } if(this.lastOverNode != n){ if(this.lastOverNode){ this.onNodeOut(this.lastOverNode, dd, e, data); } this.onNodeEnter(n, dd, e, data); this.lastOverNode = n; } return this.onNodeOver(n, dd, e, data); }, notifyOut : function(dd, e, data){ if(this.lastOverNode){ this.onNodeOut(this.lastOverNode, dd, e, data); this.lastOverNode = null; } }, notifyDrop : function(dd, e, data){ if(this.lastOverNode){ this.onNodeOut(this.lastOverNode, dd, e, data); this.lastOverNode = null; } var n = this.getTargetFromEvent(e); return n ? this.onNodeDrop(n, dd, e, data) : this.onContainerDrop(dd, e, data); }, triggerCacheRefresh : function(){ Ext.dd.DDM.refreshCache(this.groups); } }); Ext.data.SortTypes = { none : function(s){ return s; }, stripTagsRE : /<\/?[^>]+>/gi, asText : function(s){ return String(s).replace(this.stripTagsRE, ""); }, asUCText : function(s){ return String(s).toUpperCase().replace(this.stripTagsRE, ""); }, asUCString : function(s) { return String(s).toUpperCase(); }, asDate : function(s) { if(!s){ return 0; } if(Ext.isDate(s)){ return s.getTime(); } return Date.parse(String(s)); }, asFloat : function(s) { var val = parseFloat(String(s).replace(/,/g, "")); if(isNaN(val)) val = 0; return val; }, asInt : function(s) { var val = parseInt(String(s).replace(/,/g, "")); if(isNaN(val)) val = 0; return val; } }; Ext.data.Record = function(data, id){ this.id = (id || id === 0) ? id : ++Ext.data.Record.AUTO_ID; this.data = data; }; Ext.data.Record.create = function(o){ var f = Ext.extend(Ext.data.Record, {}); var p = f.prototype; p.fields = new Ext.util.MixedCollection(false, function(field){ return field.name; }); for(var i = 0, len = o.length; i < len; i++){ p.fields.add(new Ext.data.Field(o[i])); } f.getField = function(name){ return p.fields.get(name); }; return f; }; Ext.data.Record.AUTO_ID = 1000; Ext.data.Record.EDIT = 'edit'; Ext.data.Record.REJECT = 'reject'; Ext.data.Record.COMMIT = 'commit'; Ext.data.Record.prototype = { dirty : false, editing : false, error: null, modified: null, join : function(store){ this.store = store; }, set : function(name, value){ if(String(this.data[name]) == String(value)){ return; } this.dirty = true; if(!this.modified){ this.modified = {}; } if(typeof this.modified[name] == 'undefined'){ this.modified[name] = this.data[name]; } this.data[name] = value; if(!this.editing && this.store){ this.store.afterEdit(this); } }, get : function(name){ return this.data[name]; }, beginEdit : function(){ this.editing = true; this.modified = {}; }, cancelEdit : function(){ this.editing = false; delete this.modified; }, endEdit : function(){ this.editing = false; if(this.dirty && this.store){ this.store.afterEdit(this); } }, reject : function(silent){ var m = this.modified; for(var n in m){ if(typeof m[n] != "function"){ this.data[n] = m[n]; } } this.dirty = false; delete this.modified; this.editing = false; if(this.store && silent !== true){ this.store.afterReject(this); } }, commit : function(silent){ this.dirty = false; delete this.modified; this.editing = false; if(this.store && silent !== true){ this.store.afterCommit(this); } }, getChanges : function(){ var m = this.modified, cs = {}; for(var n in m){ if(m.hasOwnProperty(n)){ cs[n] = this.data[n]; } } return cs; }, hasError : function(){ return this.error != null; }, clearError : function(){ this.error = null; }, copy : function(newId) { return new this.constructor(Ext.apply({}, this.data), newId || this.id); }, isModified : function(fieldName){ return this.modified && this.modified.hasOwnProperty(fieldName); } }; Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), { register : function(){ for(var i = 0, s; s = arguments[i]; i++){ this.add(s); } }, unregister : function(){ for(var i = 0, s; s = arguments[i]; i++){ this.remove(this.lookup(s)); } }, lookup : function(id){ return typeof id == "object" ? id : this.get(id); }, getKey : function(o){ return o.storeId || o.id; } }); Ext.data.Store = function(config){ this.data = new Ext.util.MixedCollection(false); this.data.getKey = function(o){ return o.id; }; this.baseParams = {}; this.paramNames = { "start" : "start", "limit" : "limit", "sort" : "sort", "dir" : "dir" }; if(config && config.data){ this.inlineData = config.data; delete config.data; } Ext.apply(this, config); if(this.url && !this.proxy){ this.proxy = new Ext.data.HttpProxy({url: this.url}); } if(this.reader){ if(!this.recordType){ this.recordType = this.reader.recordType; } if(this.reader.onMetaChange){ this.reader.onMetaChange = this.onMetaChange.createDelegate(this); } } if(this.recordType){ this.fields = this.recordType.prototype.fields; } this.modified = []; this.addEvents( 'datachanged', 'metachange', 'add', 'remove', 'update', 'clear', 'beforeload', 'load', 'loadexception' ); if(this.proxy){ this.relayEvents(this.proxy, ["loadexception"]); } this.sortToggle = {}; if(this.sortInfo){ this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction); } Ext.data.Store.superclass.constructor.call(this); if(this.storeId || this.id){ Ext.StoreMgr.register(this); } if(this.inlineData){ this.loadData(this.inlineData); delete this.inlineData; }else if(this.autoLoad){ this.load.defer(10, this, [ typeof this.autoLoad == 'object' ? this.autoLoad : undefined]); } }; Ext.extend(Ext.data.Store, Ext.util.Observable, { remoteSort : false, pruneModifiedRecords : false, lastOptions : null, destroy : function(){ if(this.id){ Ext.StoreMgr.unregister(this); } this.data = null; this.purgeListeners(); }, add : function(records){ records = [].concat(records); if(records.length < 1){ return; } for(var i = 0, len = records.length; i < len; i++){ records[i].join(this); } var index = this.data.length; this.data.addAll(records); if(this.snapshot){ this.snapshot.addAll(records); } this.fireEvent("add", this, records, index); }, addSorted : function(record){ var index = this.findInsertIndex(record); this.insert(index, record); }, remove : function(record){ var index = this.data.indexOf(record); this.data.removeAt(index); if(this.pruneModifiedRecords){ this.modified.remove(record); } if(this.snapshot){ this.snapshot.remove(record); } this.fireEvent("remove", this, record, index); }, removeAll : function(){ this.data.clear(); if(this.snapshot){ this.snapshot.clear(); } if(this.pruneModifiedRecords){ this.modified = []; } this.fireEvent("clear", this); }, insert : function(index, records){ records = [].concat(records); for(var i = 0, len = records.length; i < len; i++){ this.data.insert(index, records[i]); records[i].join(this); } this.fireEvent("add", this, records, index); }, indexOf : function(record){ return this.data.indexOf(record); }, indexOfId : function(id){ return this.data.indexOfKey(id); }, getById : function(id){ return this.data.key(id); }, getAt : function(index){ return this.data.itemAt(index); }, getRange : function(start, end){ return this.data.getRange(start, end); }, storeOptions : function(o){ o = Ext.apply({}, o); delete o.callback; delete o.scope; this.lastOptions = o; }, load : function(options){ options = options || {}; if(this.fireEvent("beforeload", this, options) !== false){ this.storeOptions(options); var p = Ext.apply(options.params || {}, this.baseParams); if(this.sortInfo && this.remoteSort){ var pn = this.paramNames; p[pn["sort"]] = this.sortInfo.field; p[pn["dir"]] = this.sortInfo.direction; } this.proxy.load(p, this.reader, this.loadRecords, this, options); return true; } else { return false; } }, reload : function(options){ this.load(Ext.applyIf(options||{}, this.lastOptions)); }, loadRecords : function(o, options, success){ if(!o || success === false){ if(success !== false){ this.fireEvent("load", this, [], options); } if(options.callback){ options.callback.call(options.scope || this, [], options, false); } return; } var r = o.records, t = o.totalRecords || r.length; if(!options || options.add !== true){ if(this.pruneModifiedRecords){ this.modified = []; } for(var i = 0, len = r.length; i < len; i++){ r[i].join(this); } if(this.snapshot){ this.data = this.snapshot; delete this.snapshot; } this.data.clear(); this.data.addAll(r); this.totalLength = t; this.applySort(); this.fireEvent("datachanged", this); }else{ this.totalLength = Math.max(t, this.data.length+r.length); this.add(r); } this.fireEvent("load", this, r, options); if(options.callback){ options.callback.call(options.scope || this, r, options, true); } }, loadData : function(o, append){ var r = this.reader.readRecords(o); this.loadRecords(r, {add: append}, true); }, getCount : function(){ return this.data.length || 0; }, getTotalCount : function(){ return this.totalLength || 0; }, getSortState : function(){ return this.sortInfo; }, applySort : function(){ if(this.sortInfo && !this.remoteSort){ var s = this.sortInfo, f = s.field; this.sortData(f, s.direction); } }, sortData : function(f, direction){ direction = direction || 'ASC'; var st = this.fields.get(f).sortType; var fn = function(r1, r2){ var v1 = st(r1.data[f]), v2 = st(r2.data[f]); return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0); }; this.data.sort(direction, fn); if(this.snapshot && this.snapshot != this.data){ this.snapshot.sort(direction, fn); } }, setDefaultSort : function(field, dir){ dir = dir ? dir.toUpperCase() : "ASC"; this.sortInfo = {field: field, direction: dir}; this.sortToggle[field] = dir; }, sort : function(fieldName, dir){ var f = this.fields.get(fieldName); if(!f){ return false; } if(!dir){ if(this.sortInfo && this.sortInfo.field == f.name){ dir = (this.sortToggle[f.name] || "ASC").toggle("ASC", "DESC"); }else{ dir = f.sortDir; } } var st = (this.sortToggle) ? this.sortToggle[f.name] : null; var si = (this.sortInfo) ? this.sortInfo : null; this.sortToggle[f.name] = dir; this.sortInfo = {field: f.name, direction: dir}; if(!this.remoteSort){ this.applySort(); this.fireEvent("datachanged", this); }else{ if (!this.load(this.lastOptions)) { if (st) { this.sortToggle[f.name] = st; } if (si) { this.sortInfo = si; } } } }, each : function(fn, scope){ this.data.each(fn, scope); }, getModifiedRecords : function(){ return this.modified; }, createFilterFn : function(property, value, anyMatch, caseSensitive){ if(Ext.isEmpty(value, false)){ return false; } value = this.data.createValueMatcher(value, anyMatch, caseSensitive); return function(r){ return value.test(r.data[property]); }; }, sum : function(property, start, end){ var rs = this.data.items, v = 0; start = start || 0; end = (end || end === 0) ? end : rs.length-1; for(var i = start; i <= end; i++){ v += (rs[i].data[property] || 0); } return v; }, filter : function(property, value, anyMatch, caseSensitive){ var fn = this.createFilterFn(property, value, anyMatch, caseSensitive); return fn ? this.filterBy(fn) : this.clearFilter(); }, filterBy : function(fn, scope){ this.snapshot = this.snapshot || this.data; this.data = this.queryBy(fn, scope||this); this.fireEvent("datachanged", this); }, query : function(property, value, anyMatch, caseSensitive){ var fn = this.createFilterFn(property, value, anyMatch, caseSensitive); return fn ? this.queryBy(fn) : this.data.clone(); }, queryBy : function(fn, scope){ var data = this.snapshot || this.data; return data.filterBy(fn, scope||this); }, find : function(property, value, start, anyMatch, caseSensitive){ var fn = this.createFilterFn(property, value, anyMatch, caseSensitive); return fn ? this.data.findIndexBy(fn, null, start) : -1; }, findBy : function(fn, scope, start){ return this.data.findIndexBy(fn, scope, start); }, collect : function(dataIndex, allowNull, bypassFilter){ var d = (bypassFilter === true && this.snapshot) ? this.snapshot.items : this.data.items; var v, sv, r = [], l = {}; for(var i = 0, len = d.length; i < len; i++){ v = d[i].data[dataIndex]; sv = String(v); if((allowNull || !Ext.isEmpty(v)) && !l[sv]){ l[sv] = true; r[r.length] = v; } } return r; }, clearFilter : function(suppressEvent){ if(this.isFiltered()){ this.data = this.snapshot; delete this.snapshot; if(suppressEvent !== true){ this.fireEvent("datachanged", this); } } }, isFiltered : function(){ return this.snapshot && this.snapshot != this.data; }, afterEdit : function(record){ if(this.modified.indexOf(record) == -1){ this.modified.push(record); } this.fireEvent("update", this, record, Ext.data.Record.EDIT); }, afterReject : function(record){ this.modified.remove(record); this.fireEvent("update", this, record, Ext.data.Record.REJECT); }, afterCommit : function(record){ this.modified.remove(record); this.fireEvent("update", this, record, Ext.data.Record.COMMIT); }, commitChanges : function(){ var m = this.modified.slice(0); this.modified = []; for(var i = 0, len = m.length; i < len; i++){ m[i].commit(); } }, rejectChanges : function(){ var m = this.modified.slice(0); this.modified = []; for(var i = 0, len = m.length; i < len; i++){ m[i].reject(); } }, onMetaChange : function(meta, rtype, o){ this.recordType = rtype; this.fields = rtype.prototype.fields; delete this.snapshot; this.sortInfo = meta.sortInfo; this.modified = []; this.fireEvent('metachange', this, this.reader.meta); }, findInsertIndex : function(record){ this.suspendEvents(); var data = this.data.clone(); this.data.add(record); this.applySort(); var index = this.data.indexOf(record); this.data = data; this.resumeEvents(); return index; } }); Ext.data.SimpleStore = function(config){ Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, { reader: new Ext.data.ArrayReader({ id: config.id }, Ext.data.Record.create(config.fields) ) })); }; Ext.extend(Ext.data.SimpleStore, Ext.data.Store, { loadData : function(data, append){ if(this.expandData === true){ var r = []; for(var i = 0, len = data.length; i < len; i++){ r[r.length] = [data[i]]; } data = r; } Ext.data.SimpleStore.superclass.loadData.call(this, data, append); } }); Ext.data.JsonStore = function(c){ Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(c, { proxy: !c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined, reader: new Ext.data.JsonReader(c, c.fields) })); }; Ext.extend(Ext.data.JsonStore, Ext.data.Store); Ext.data.Field = function(config){ if(typeof config == "string"){ config = {name: config}; } Ext.apply(this, config); if(!this.type){ this.type = "auto"; } var st = Ext.data.SortTypes; if(typeof this.sortType == "string"){ this.sortType = st[this.sortType]; } if(!this.sortType){ switch(this.type){ case "string": this.sortType = st.asUCString; break; case "date": this.sortType = st.asDate; break; default: this.sortType = st.none; } } var stripRe = /[\$,%]/g; if(!this.convert){ var cv, dateFormat = this.dateFormat; switch(this.type){ case "": case "auto": case undefined: cv = function(v){ return v; }; break; case "string": cv = function(v){ return (v === undefined || v === null) ? '' : String(v); }; break; case "int": cv = function(v){ return v !== undefined && v !== null && v !== '' ? parseInt(String(v).replace(stripRe, ""), 10) : ''; }; break; case "float": cv = function(v){ return v !== undefined && v !== null && v !== '' ? parseFloat(String(v).replace(stripRe, ""), 10) : ''; }; break; case "bool": case "boolean": cv = function(v){ return v === true || v === "true" || v == 1; }; break; case "date": cv = function(v){ if(!v){ return ''; } if(Ext.isDate(v)){ return v; } if(dateFormat){ if(dateFormat == "timestamp"){ return new Date(v*1000); } if(dateFormat == "time"){ return new Date(parseInt(v, 10)); } return Date.parseDate(v, dateFormat); } var parsed = Date.parse(v); return parsed ? new Date(parsed) : null; }; break; } this.convert = cv; } }; Ext.data.Field.prototype = { dateFormat: null, defaultValue: "", mapping: null, sortType : null, sortDir : "ASC" }; Ext.data.DataReader = function(meta, recordType){ this.meta = meta; this.recordType = Ext.isArray(recordType) ? Ext.data.Record.create(recordType) : recordType; }; Ext.data.DataReader.prototype = { }; Ext.data.DataProxy = function(){ this.addEvents( 'beforeload', 'load', 'loadexception' ); Ext.data.DataProxy.superclass.constructor.call(this); }; Ext.extend(Ext.data.DataProxy, Ext.util.Observable); Ext.data.MemoryProxy = function(data){ Ext.data.MemoryProxy.superclass.constructor.call(this); this.data = data; }; Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, { load : function(params, reader, callback, scope, arg){ params = params || {}; var result; try { result = reader.readRecords(this.data); }catch(e){ this.fireEvent("loadexception", this, arg, null, e); callback.call(scope, null, arg, false); return; } callback.call(scope, result, arg, true); }, update : function(params, records){ } }); Ext.data.HttpProxy = function(conn){ Ext.data.HttpProxy.superclass.constructor.call(this); this.conn = conn; this.useAjax = !conn || !conn.events; }; Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, { getConnection : function(){ return this.useAjax ? Ext.Ajax : this.conn; }, load : function(params, reader, callback, scope, arg){ if(this.fireEvent("beforeload", this, params) !== false){ var o = { params : params || {}, request: { callback : callback, scope : scope, arg : arg }, reader: reader, callback : this.loadResponse, scope: this }; if(this.useAjax){ Ext.applyIf(o, this.conn); if(this.activeRequest){ Ext.Ajax.abort(this.activeRequest); } this.activeRequest = Ext.Ajax.request(o); }else{ this.conn.request(o); } }else{ callback.call(scope||this, null, arg, false); } }, loadResponse : function(o, success, response){ delete this.activeRequest; if(!success){ this.fireEvent("loadexception", this, o, response); o.request.callback.call(o.request.scope, null, o.request.arg, false); return; } var result; try { result = o.reader.read(response); }catch(e){ this.fireEvent("loadexception", this, o, response, e); o.request.callback.call(o.request.scope, null, o.request.arg, false); return; } this.fireEvent("load", this, o, o.request.arg); o.request.callback.call(o.request.scope, result, o.request.arg, true); }, update : function(dataSet){ }, updateResponse : function(dataSet){ } }); Ext.data.ScriptTagProxy = function(config){ Ext.data.ScriptTagProxy.superclass.constructor.call(this); Ext.apply(this, config); this.head = document.getElementsByTagName("head")[0]; }; Ext.data.ScriptTagProxy.TRANS_ID = 1000; Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, { timeout : 30000, callbackParam : "callback", nocache : true, load : function(params, reader, callback, scope, arg){ if(this.fireEvent("beforeload", this, params) !== false){ var p = Ext.urlEncode(Ext.apply(params, this.extraParams)); var url = this.url; url += (url.indexOf("?") != -1 ? "&" : "?") + p; if(this.nocache){ url += "&_dc=" + (new Date().getTime()); } var transId = ++Ext.data.ScriptTagProxy.TRANS_ID; var trans = { id : transId, cb : "stcCallback"+transId, scriptId : "stcScript"+transId, params : params, arg : arg, url : url, callback : callback, scope : scope, reader : reader }; var conn = this; window[trans.cb] = function(o){ conn.handleResponse(o, trans); }; url += String.format("&{0}={1}", this.callbackParam, trans.cb); if(this.autoAbort !== false){ this.abort(); } trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]); var script = document.createElement("script"); script.setAttribute("src", url); script.setAttribute("type", "text/javascript"); script.setAttribute("id", trans.scriptId); this.head.appendChild(script); this.trans = trans; }else{ callback.call(scope||this, null, arg, false); } }, isLoading : function(){ return this.trans ? true : false; }, abort : function(){ if(this.isLoading()){ this.destroyTrans(this.trans); } }, destroyTrans : function(trans, isLoaded){ this.head.removeChild(document.getElementById(trans.scriptId)); clearTimeout(trans.timeoutId); if(isLoaded){ window[trans.cb] = undefined; try{ delete window[trans.cb]; }catch(e){} }else{ window[trans.cb] = function(){ window[trans.cb] = undefined; try{ delete window[trans.cb]; }catch(e){} }; } }, handleResponse : function(o, trans){ this.trans = false; this.destroyTrans(trans, true); var result; try { result = trans.reader.readRecords(o); }catch(e){ this.fireEvent("loadexception", this, o, trans.arg, e); trans.callback.call(trans.scope||window, null, trans.arg, false); return; } this.fireEvent("load", this, o, trans.arg); trans.callback.call(trans.scope||window, result, trans.arg, true); }, handleFailure : function(trans){ this.trans = false; this.destroyTrans(trans, false); this.fireEvent("loadexception", this, null, trans.arg); trans.callback.call(trans.scope||window, null, trans.arg, false); } }); Ext.data.JsonReader = function(meta, recordType){ meta = meta || {}; Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields); }; Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, { read : function(response){ var json = response.responseText; var o = eval("("+json+")"); if(!o) { throw {message: "JsonReader.read: Json object not found"}; } if(o.metaData){ delete this.ef; this.meta = o.metaData; this.recordType = Ext.data.Record.create(o.metaData.fields); this.onMetaChange(this.meta, this.recordType, o); } return this.readRecords(o); }, onMetaChange : function(meta, recordType, o){ }, simpleAccess: function(obj, subsc) { return obj[subsc]; }, getJsonAccessor: function(){ var re = /[\[\.]/; return function(expr) { try { return(re.test(expr)) ? new Function("obj", "return obj." + expr) : function(obj){ return obj[expr]; }; } catch(e){} return Ext.emptyFn; }; }(), readRecords : function(o){ this.jsonData = o; var s = this.meta, Record = this.recordType, f = Record.prototype.fields, fi = f.items, fl = f.length; if (!this.ef) { if(s.totalProperty) { this.getTotal = this.getJsonAccessor(s.totalProperty); } if(s.successProperty) { this.getSuccess = this.getJsonAccessor(s.successProperty); } this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;}; if (s.id) { var g = this.getJsonAccessor(s.id); this.getId = function(rec) { var r = g(rec); return (r === undefined || r === "") ? null : r; }; } else { this.getId = function(){return null;}; } this.ef = []; for(var i = 0; i < fl; i++){ f = fi[i]; var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name; this.ef[i] = this.getJsonAccessor(map); } } var root = this.getRoot(o), c = root.length, totalRecords = c, success = true; if(s.totalProperty){ var v = parseInt(this.getTotal(o), 10); if(!isNaN(v)){ totalRecords = v; } } if(s.successProperty){ var v = this.getSuccess(o); if(v === false || v === 'false'){ success = false; } } var records = []; for(var i = 0; i < c; i++){ var n = root[i]; var values = {}; var id = this.getId(n); for(var j = 0; j < fl; j++){ f = fi[j]; var v = this.ef[j](n); values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, n); } var record = new Record(values, id); record.json = n; records[i] = record; } return { success : success, records : records, totalRecords : totalRecords }; } }); Ext.data.XmlReader = function(meta, recordType){ meta = meta || {}; Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields); }; Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { read : function(response){ var doc = response.responseXML; if(!doc) { throw {message: "XmlReader.read: XML Document not available"}; } return this.readRecords(doc); }, readRecords : function(doc){ this.xmlData = doc; var root = doc.documentElement || doc; var q = Ext.DomQuery; var recordType = this.recordType, fields = recordType.prototype.fields; var sid = this.meta.id; var totalRecords = 0, success = true; if(this.meta.totalRecords){ totalRecords = q.selectNumber(this.meta.totalRecords, root, 0); } if(this.meta.success){ var sv = q.selectValue(this.meta.success, root, true); success = sv !== false && sv !== 'false'; } var records = []; var ns = q.select(this.meta.record, root); for(var i = 0, len = ns.length; i < len; i++) { var n = ns[i]; var values = {}; var id = sid ? q.selectValue(sid, n) : undefined; for(var j = 0, jlen = fields.length; j < jlen; j++){ var f = fields.items[j]; var v = q.selectValue(f.mapping || f.name, n, f.defaultValue); v = f.convert(v, n); values[f.name] = v; } var record = new recordType(values, id); record.node = n; records[records.length] = record; } return { success : success, records : records, totalRecords : totalRecords || records.length }; } }); Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, { readRecords : function(o){ var sid = this.meta ? this.meta.id : null; var recordType = this.recordType, fields = recordType.prototype.fields; var records = []; var root = o; for(var i = 0; i < root.length; i++){ var n = root[i]; var values = {}; var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null); for(var j = 0, jlen = fields.length; j < jlen; j++){ var f = fields.items[j]; var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j; var v = n[k] !== undefined ? n[k] : f.defaultValue; v = f.convert(v, n); values[f.name] = v; } var record = new recordType(values, id); record.json = n; records[records.length] = record; } return { records : records, totalRecords : records.length }; } }); Ext.data.Tree = function(root){ this.nodeHash = {}; this.root = null; if(root){ this.setRootNode(root); } this.addEvents( "append", "remove", "move", "insert", "beforeappend", "beforeremove", "beforemove", "beforeinsert" ); Ext.data.Tree.superclass.constructor.call(this); }; Ext.extend(Ext.data.Tree, Ext.util.Observable, { pathSeparator: "/", proxyNodeEvent : function(){ return this.fireEvent.apply(this, arguments); }, getRootNode : function(){ return this.root; }, setRootNode : function(node){ this.root = node; node.ownerTree = this; node.isRoot = true; this.registerNode(node); return node; }, getNodeById : function(id){ return this.nodeHash[id]; }, registerNode : function(node){ this.nodeHash[node.id] = node; }, unregisterNode : function(node){ delete this.nodeHash[node.id]; }, toString : function(){ return "[Tree"+(this.id?" "+this.id:"")+"]"; } }); Ext.data.Node = function(attributes){ this.attributes = attributes || {}; this.leaf = this.attributes.leaf; this.id = this.attributes.id; if(!this.id){ this.id = Ext.id(null, "ynode-"); this.attributes.id = this.id; } this.childNodes = []; if(!this.childNodes.indexOf){ this.childNodes.indexOf = function(o){ for(var i = 0, len = this.length; i < len; i++){ if(this[i] == o) return i; } return -1; }; } this.parentNode = null; this.firstChild = null; this.lastChild = null; this.previousSibling = null; this.nextSibling = null; this.addEvents({ "append" : true, "remove" : true, "move" : true, "insert" : true, "beforeappend" : true, "beforeremove" : true, "beforemove" : true, "beforeinsert" : true }); this.listeners = this.attributes.listeners; Ext.data.Node.superclass.constructor.call(this); }; Ext.extend(Ext.data.Node, Ext.util.Observable, { fireEvent : function(evtName){ if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){ return false; } var ot = this.getOwnerTree(); if(ot){ if(ot.proxyNodeEvent.apply(ot, arguments) === false){ return false; } } return true; }, isLeaf : function(){ return this.leaf === true; }, setFirstChild : function(node){ this.firstChild = node; }, setLastChild : function(node){ this.lastChild = node; }, isLast : function(){ return (!this.parentNode ? true : this.parentNode.lastChild == this); }, isFirst : function(){ return (!this.parentNode ? true : this.parentNode.firstChild == this); }, hasChildNodes : function(){ return !this.isLeaf() && this.childNodes.length > 0; }, appendChild : function(node){ var multi = false; if(Ext.isArray(node)){ multi = node; }else if(arguments.length > 1){ multi = arguments; } if(multi){ for(var i = 0, len = multi.length; i < len; i++) { this.appendChild(multi[i]); } }else{ if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){ return false; } var index = this.childNodes.length; var oldParent = node.parentNode; if(oldParent){ if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){ return false; } oldParent.removeChild(node); } index = this.childNodes.length; if(index == 0){ this.setFirstChild(node); } this.childNodes.push(node); node.parentNode = this; var ps = this.childNodes[index-1]; if(ps){ node.previousSibling = ps; ps.nextSibling = node; }else{ node.previousSibling = null; } node.nextSibling = null; this.setLastChild(node); node.setOwnerTree(this.getOwnerTree()); this.fireEvent("append", this.ownerTree, this, node, index); if(oldParent){ node.fireEvent("move", this.ownerTree, node, oldParent, this, index); } return node; } }, removeChild : function(node){ var index = this.childNodes.indexOf(node); if(index == -1){ return false; } if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){ return false; } this.childNodes.splice(index, 1); if(node.previousSibling){ node.previousSibling.nextSibling = node.nextSibling; } if(node.nextSibling){ node.nextSibling.previousSibling = node.previousSibling; } if(this.firstChild == node){ this.setFirstChild(node.nextSibling); } if(this.lastChild == node){ this.setLastChild(node.previousSibling); } node.setOwnerTree(null); node.parentNode = null; node.previousSibling = null; node.nextSibling = null; this.fireEvent("remove", this.ownerTree, this, node); return node; }, insertBefore : function(node, refNode){ if(!refNode){ return this.appendChild(node); } if(node == refNode){ return false; } if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){ return false; } var index = this.childNodes.indexOf(refNode); var oldParent = node.parentNode; var refIndex = index; if(oldParent == this && this.childNodes.indexOf(node) < index){ refIndex--; } if(oldParent){ if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){ return false; } oldParent.removeChild(node); } if(refIndex == 0){ this.setFirstChild(node); } this.childNodes.splice(refIndex, 0, node); node.parentNode = this; var ps = this.childNodes[refIndex-1]; if(ps){ node.previousSibling = ps; ps.nextSibling = node; }else{ node.previousSibling = null; } node.nextSibling = refNode; refNode.previousSibling = node; node.setOwnerTree(this.getOwnerTree()); this.fireEvent("insert", this.ownerTree, this, node, refNode); if(oldParent){ node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode); } return node; }, remove : function(){ this.parentNode.removeChild(this); return this; }, item : function(index){ return this.childNodes[index]; }, replaceChild : function(newChild, oldChild){ this.insertBefore(newChild, oldChild); this.removeChild(oldChild); return oldChild; }, indexOf : function(child){ return this.childNodes.indexOf(child); }, getOwnerTree : function(){ if(!this.ownerTree){ var p = this; while(p){ if(p.ownerTree){ this.ownerTree = p.ownerTree; break; } p = p.parentNode; } } return this.ownerTree; }, getDepth : function(){ var depth = 0; var p = this; while(p.parentNode){ ++depth; p = p.parentNode; } return depth; }, setOwnerTree : function(tree){ if(tree != this.ownerTree){ if(this.ownerTree){ this.ownerTree.unregisterNode(this); } this.ownerTree = tree; var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { cs[i].setOwnerTree(tree); } if(tree){ tree.registerNode(this); } } }, getPath : function(attr){ attr = attr || "id"; var p = this.parentNode; var b = [this.attributes[attr]]; while(p){ b.unshift(p.attributes[attr]); p = p.parentNode; } var sep = this.getOwnerTree().pathSeparator; return sep + b.join(sep); }, bubble : function(fn, scope, args){ var p = this; while(p){ if(fn.apply(scope || p, args || [p]) === false){ break; } p = p.parentNode; } }, cascade : function(fn, scope, args){ if(fn.apply(scope || this, args || [this]) !== false){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { cs[i].cascade(fn, scope, args); } } }, eachChild : function(fn, scope, args){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { if(fn.apply(scope || this, args || [cs[i]]) === false){ break; } } }, findChild : function(attribute, value){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { if(cs[i].attributes[attribute] == value){ return cs[i]; } } return null; }, findChildBy : function(fn, scope){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { if(fn.call(scope||cs[i], cs[i]) === true){ return cs[i]; } } return null; }, sort : function(fn, scope){ var cs = this.childNodes; var len = cs.length; if(len > 0){ var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn; cs.sort(sortFn); for(var i = 0; i < len; i++){ var n = cs[i]; n.previousSibling = cs[i-1]; n.nextSibling = cs[i+1]; if(i == 0){ this.setFirstChild(n); } if(i == len-1){ this.setLastChild(n); } } } }, contains : function(node){ return node.isAncestor(this); }, isAncestor : function(node){ var p = this.parentNode; while(p){ if(p == node){ return true; } p = p.parentNode; } return false; }, toString : function(){ return "[Node"+(this.id?" "+this.id:"")+"]"; } }); Ext.data.GroupingStore = Ext.extend(Ext.data.Store, { remoteGroup : false, groupOnSort:false, clearGrouping : function(){ this.groupField = false; if(this.remoteGroup){ if(this.baseParams){ delete this.baseParams.groupBy; } this.reload(); }else{ this.applySort(); this.fireEvent('datachanged', this); } }, groupBy : function(field, forceRegroup){ if(this.groupField == field && !forceRegroup){ return; } this.groupField = field; if(this.remoteGroup){ if(!this.baseParams){ this.baseParams = {}; } this.baseParams['groupBy'] = field; } if(this.groupOnSort){ this.sort(field); return; } if(this.remoteGroup){ this.reload(); }else{ var si = this.sortInfo || {}; if(si.field != field){ this.applySort(); }else{ this.sortData(field); } this.fireEvent('datachanged', this); } }, applySort : function(){ Ext.data.GroupingStore.superclass.applySort.call(this); if(!this.groupOnSort && !this.remoteGroup){ var gs = this.getGroupState(); if(gs && gs != this.sortInfo.field){ this.sortData(this.groupField); } } }, applyGrouping : function(alwaysFireChange){ if(this.groupField !== false){ this.groupBy(this.groupField, true); return true; }else{ if(alwaysFireChange === true){ this.fireEvent('datachanged', this); } return false; } }, getGroupState : function(){ return this.groupOnSort && this.groupField !== false ? (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField; } }); Ext.ComponentMgr = function(){ var all = new Ext.util.MixedCollection(); var types = {}; return { register : function(c){ all.add(c); }, unregister : function(c){ all.remove(c); }, get : function(id){ return all.get(id); }, onAvailable : function(id, fn, scope){ all.on("add", function(index, o){ if(o.id == id){ fn.call(scope || o, o); all.un("add", fn, scope); } }); }, all : all, registerType : function(xtype, cls){ types[xtype] = cls; cls.xtype = xtype; }, create : function(config, defaultType){ return new types[config.xtype || defaultType](config); } }; }(); Ext.reg = Ext.ComponentMgr.registerType; Ext.Component = function(config){ config = config || {}; if(config.initialConfig){ if(config.isAction){ this.baseAction = config; } config = config.initialConfig; }else if(config.tagName || config.dom || typeof config == "string"){ config = {applyTo: config, id: config.id || config}; } this.initialConfig = config; Ext.apply(this, config); this.addEvents( 'disable', 'enable', 'beforeshow', 'show', 'beforehide', 'hide', 'beforerender', 'render', 'beforedestroy', 'destroy', 'beforestaterestore', 'staterestore', 'beforestatesave', 'statesave' ); this.getId(); Ext.ComponentMgr.register(this); Ext.Component.superclass.constructor.call(this); if(this.baseAction){ this.baseAction.addComponent(this); } this.initComponent(); if(this.plugins){ if(Ext.isArray(this.plugins)){ for(var i = 0, len = this.plugins.length; i < len; i++){ this.plugins[i].init(this); } }else{ this.plugins.init(this); } } if(this.stateful !== false){ this.initState(config); } if(this.applyTo){ this.applyToMarkup(this.applyTo); delete this.applyTo; }else if(this.renderTo){ this.render(this.renderTo); delete this.renderTo; } }; Ext.Component.AUTO_ID = 1000; Ext.extend(Ext.Component, Ext.util.Observable, { disabledClass : "x-item-disabled", allowDomMove : true, autoShow : false, hideMode: 'display', hideParent: false, hidden : false, disabled : false, rendered : false, ctype : "Ext.Component", actionMode : "el", getActionEl : function(){ return this[this.actionMode]; }, initComponent : Ext.emptyFn, render : function(container, position){ if(!this.rendered && this.fireEvent("beforerender", this) !== false){ if(!container && this.el){ this.el = Ext.get(this.el); container = this.el.dom.parentNode; this.allowDomMove = false; } this.container = Ext.get(container); if(this.ctCls){ this.container.addClass(this.ctCls); } this.rendered = true; if(position !== undefined){ if(typeof position == 'number'){ position = this.container.dom.childNodes[position]; }else{ position = Ext.getDom(position); } } this.onRender(this.container, position || null); if(this.autoShow){ this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]); } if(this.cls){ this.el.addClass(this.cls); delete this.cls; } if(this.style){ this.el.applyStyles(this.style); delete this.style; } this.fireEvent("render", this); this.afterRender(this.container); if(this.hidden){ this.hide(); } if(this.disabled){ this.disable(); } this.initStateEvents(); } return this; }, initState : function(config){ if(Ext.state.Manager){ var state = Ext.state.Manager.get(this.stateId || this.id); if(state){ if(this.fireEvent('beforestaterestore', this, state) !== false){ this.applyState(state); this.fireEvent('staterestore', this, state); } } } }, initStateEvents : function(){ if(this.stateEvents){ for(var i = 0, e; e = this.stateEvents[i]; i++){ this.on(e, this.saveState, this, {delay:100}); } } }, applyState : function(state, config){ if(state){ Ext.apply(this, state); } }, getState : function(){ return null; }, saveState : function(){ if(Ext.state.Manager){ var state = this.getState(); if(this.fireEvent('beforestatesave', this, state) !== false){ Ext.state.Manager.set(this.stateId || this.id, state); this.fireEvent('statesave', this, state); } } }, applyToMarkup : function(el){ this.allowDomMove = false; this.el = Ext.get(el); this.render(this.el.dom.parentNode); }, addClass : function(cls){ if(this.el){ this.el.addClass(cls); }else{ this.cls = this.cls ? this.cls + ' ' + cls : cls; } }, removeClass : function(cls){ if(this.el){ this.el.removeClass(cls); }else if(this.cls){ this.cls = this.cls.split(' ').remove(cls).join(' '); } }, onRender : function(ct, position){ if(this.autoEl){ if(typeof this.autoEl == 'string'){ this.el = document.createElement(this.autoEl); }else{ var div = document.createElement('div'); Ext.DomHelper.overwrite(div, this.autoEl); this.el = div.firstChild; } if (!this.el.id) { this.el.id = this.getId(); } } if(this.el){ this.el = Ext.get(this.el); if(this.allowDomMove !== false){ ct.dom.insertBefore(this.el.dom, position); } } }, getAutoCreate : function(){ var cfg = typeof this.autoCreate == "object" ? this.autoCreate : Ext.apply({}, this.defaultAutoCreate); if(this.id && !cfg.id){ cfg.id = this.id; } return cfg; }, afterRender : Ext.emptyFn, destroy : function(){ if(this.fireEvent("beforedestroy", this) !== false){ this.beforeDestroy(); if(this.rendered){ this.el.removeAllListeners(); this.el.remove(); if(this.actionMode == "container"){ this.container.remove(); } } this.onDestroy(); Ext.ComponentMgr.unregister(this); this.fireEvent("destroy", this); this.purgeListeners(); } }, beforeDestroy : Ext.emptyFn, onDestroy : Ext.emptyFn, getEl : function(){ return this.el; }, getId : function(){ return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID)); }, getItemId : function(){ return this.itemId || this.getId(); }, focus : function(selectText, delay){ if(delay){ this.focus.defer(typeof delay == 'number' ? delay : 10, this, [selectText, false]); return; } if(this.rendered){ this.el.focus(); if(selectText === true){ this.el.dom.select(); } } return this; }, blur : function(){ if(this.rendered){ this.el.blur(); } return this; }, disable : function(){ if(this.rendered){ this.onDisable(); } this.disabled = true; this.fireEvent("disable", this); return this; }, onDisable : function(){ this.getActionEl().addClass(this.disabledClass); this.el.dom.disabled = true; }, enable : function(){ if(this.rendered){ this.onEnable(); } this.disabled = false; this.fireEvent("enable", this); return this; }, onEnable : function(){ this.getActionEl().removeClass(this.disabledClass); this.el.dom.disabled = false; }, setDisabled : function(disabled){ this[disabled ? "disable" : "enable"](); }, show: function(){ if(this.fireEvent("beforeshow", this) !== false){ this.hidden = false; if(this.autoRender){ this.render(typeof this.autoRender == 'boolean' ? Ext.getBody() : this.autoRender); } if(this.rendered){ this.onShow(); } this.fireEvent("show", this); } return this; }, onShow : function(){ if(this.hideParent){ this.container.removeClass('x-hide-' + this.hideMode); }else{ this.getActionEl().removeClass('x-hide-' + this.hideMode); } }, hide: function(){ if(this.fireEvent("beforehide", this) !== false){ this.hidden = true; if(this.rendered){ this.onHide(); } this.fireEvent("hide", this); } return this; }, onHide : function(){ if(this.hideParent){ this.container.addClass('x-hide-' + this.hideMode); }else{ this.getActionEl().addClass('x-hide-' + this.hideMode); } }, setVisible: function(visible){ if(visible) { this.show(); }else{ this.hide(); } return this; }, isVisible : function(){ return this.rendered && this.getActionEl().isVisible(); }, cloneConfig : function(overrides){ overrides = overrides || {}; var id = overrides.id || Ext.id(); var cfg = Ext.applyIf(overrides, this.initialConfig); cfg.id = id; return new this.constructor(cfg); }, getXType : function(){ return this.constructor.xtype; }, isXType : function(xtype, shallow){ return !shallow ? ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 : this.constructor.xtype == xtype; }, getXTypes : function(){ var tc = this.constructor; if(!tc.xtypes){ var c = [], sc = this; while(sc && sc.constructor.xtype){ c.unshift(sc.constructor.xtype); sc = sc.constructor.superclass; } tc.xtypeChain = c; tc.xtypes = c.join('/'); } return tc.xtypes; }, findParentBy: function(fn) { for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt); return p || null; }, findParentByType: function(xtype) { return typeof xtype == 'function' ? this.findParentBy(function(p){ return p.constructor === xtype; }) : this.findParentBy(function(p){ return p.constructor.xtype === xtype; }); } }); Ext.reg('component', Ext.Component); Ext.Action = function(config){ this.initialConfig = config; this.items = []; } Ext.Action.prototype = { isAction : true, setText : function(text){ this.initialConfig.text = text; this.callEach('setText', [text]); }, getText : function(){ return this.initialConfig.text; }, setIconClass : function(cls){ this.initialConfig.iconCls = cls; this.callEach('setIconClass', [cls]); }, getIconClass : function(){ return this.initialConfig.iconCls; }, setDisabled : function(v){ this.initialConfig.disabled = v; this.callEach('setDisabled', [v]); }, enable : function(){ this.setDisabled(false); }, disable : function(){ this.setDisabled(true); }, isDisabled : function(){ return this.initialConfig.disabled; }, setHidden : function(v){ this.initialConfig.hidden = v; this.callEach('setVisible', [!v]); }, show : function(){ this.setHidden(false); }, hide : function(){ this.setHidden(true); }, isHidden : function(){ return this.initialConfig.hidden; }, setHandler : function(fn, scope){ this.initialConfig.handler = fn; this.initialConfig.scope = scope; this.callEach('setHandler', [fn, scope]); }, each : function(fn, scope){ Ext.each(this.items, fn, scope); }, callEach : function(fnName, args){ var cs = this.items; for(var i = 0, len = cs.length; i < len; i++){ cs[i][fnName].apply(cs[i], args); } }, addComponent : function(comp){ this.items.push(comp); comp.on('destroy', this.removeComponent, this); }, removeComponent : function(comp){ this.items.remove(comp); }, execute : function(){ this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments); } }; (function(){ Ext.Layer = function(config, existingEl){ config = config || {}; var dh = Ext.DomHelper; var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body; if(existingEl){ this.dom = Ext.getDom(existingEl); } if(!this.dom){ var o = config.dh || {tag: "div", cls: "x-layer"}; this.dom = dh.append(pel, o); } if(config.cls){ this.addClass(config.cls); } this.constrain = config.constrain !== false; this.visibilityMode = Ext.Element.VISIBILITY; if(config.id){ this.id = this.dom.id = config.id; }else{ this.id = Ext.id(this.dom); } this.zindex = config.zindex || this.getZIndex(); this.position("absolute", this.zindex); if(config.shadow){ this.shadowOffset = config.shadowOffset || 4; this.shadow = new Ext.Shadow({ offset : this.shadowOffset, mode : config.shadow }); }else{ this.shadowOffset = 0; } this.useShim = config.shim !== false && Ext.useShims; this.useDisplay = config.useDisplay; this.hide(); }; var supr = Ext.Element.prototype; var shims = []; Ext.extend(Ext.Layer, Ext.Element, { getZIndex : function(){ return this.zindex || parseInt(this.getStyle("z-index"), 10) || 11000; }, getShim : function(){ if(!this.useShim){ return null; } if(this.shim){ return this.shim; } var shim = shims.shift(); if(!shim){ shim = this.createShim(); shim.enableDisplayMode('block'); shim.dom.style.display = 'none'; shim.dom.style.visibility = 'visible'; } var pn = this.dom.parentNode; if(shim.dom.parentNode != pn){ pn.insertBefore(shim.dom, this.dom); } shim.setStyle('z-index', this.getZIndex()-2); this.shim = shim; return shim; }, hideShim : function(){ if(this.shim){ this.shim.setDisplayed(false); shims.push(this.shim); delete this.shim; } }, disableShadow : function(){ if(this.shadow){ this.shadowDisabled = true; this.shadow.hide(); this.lastShadowOffset = this.shadowOffset; this.shadowOffset = 0; } }, enableShadow : function(show){ if(this.shadow){ this.shadowDisabled = false; this.shadowOffset = this.lastShadowOffset; delete this.lastShadowOffset; if(show){ this.sync(true); } } }, sync : function(doShow){ var sw = this.shadow; if(!this.updating && this.isVisible() && (sw || this.useShim)){ var sh = this.getShim(); var w = this.getWidth(), h = this.getHeight(); var l = this.getLeft(true), t = this.getTop(true); if(sw && !this.shadowDisabled){ if(doShow && !sw.isVisible()){ sw.show(this); }else{ sw.realign(l, t, w, h); } if(sh){ if(doShow){ sh.show(); } var a = sw.adjusts, s = sh.dom.style; s.left = (Math.min(l, l+a.l))+"px"; s.top = (Math.min(t, t+a.t))+"px"; s.width = (w+a.w)+"px"; s.height = (h+a.h)+"px"; } }else if(sh){ if(doShow){ sh.show(); } sh.setSize(w, h); sh.setLeftTop(l, t); } } }, destroy : function(){ this.hideShim(); if(this.shadow){ this.shadow.hide(); } this.removeAllListeners(); Ext.removeNode(this.dom); Ext.Element.uncache(this.id); }, remove : function(){ this.destroy(); }, beginUpdate : function(){ this.updating = true; }, endUpdate : function(){ this.updating = false; this.sync(true); }, hideUnders : function(negOffset){ if(this.shadow){ this.shadow.hide(); } this.hideShim(); }, constrainXY : function(){ if(this.constrain){ var vw = Ext.lib.Dom.getViewWidth(), vh = Ext.lib.Dom.getViewHeight(); var s = Ext.getDoc().getScroll(); var xy = this.getXY(); var x = xy[0], y = xy[1]; var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset; var moved = false; if((x + w) > vw+s.left){ x = vw - w - this.shadowOffset; moved = true; } if((y + h) > vh+s.top){ y = vh - h - this.shadowOffset; moved = true; } if(x < s.left){ x = s.left; moved = true; } if(y < s.top){ y = s.top; moved = true; } if(moved){ if(this.avoidY){ var ay = this.avoidY; if(y <= ay && (y+h) >= ay){ y = ay-h-5; } } xy = [x, y]; this.storeXY(xy); supr.setXY.call(this, xy); this.sync(); } } }, isVisible : function(){ return this.visible; }, showAction : function(){ this.visible = true; if(this.useDisplay === true){ this.setDisplayed(""); }else if(this.lastXY){ supr.setXY.call(this, this.lastXY); }else if(this.lastLT){ supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]); } }, hideAction : function(){ this.visible = false; if(this.useDisplay === true){ this.setDisplayed(false); }else{ this.setLeftTop(-10000,-10000); } }, setVisible : function(v, a, d, c, e){ if(v){ this.showAction(); } if(a && v){ var cb = function(){ this.sync(true); if(c){ c(); } }.createDelegate(this); supr.setVisible.call(this, true, true, d, cb, e); }else{ if(!v){ this.hideUnders(true); } var cb = c; if(a){ cb = function(){ this.hideAction(); if(c){ c(); } }.createDelegate(this); } supr.setVisible.call(this, v, a, d, cb, e); if(v){ this.sync(true); }else if(!a){ this.hideAction(); } } }, storeXY : function(xy){ delete this.lastLT; this.lastXY = xy; }, storeLeftTop : function(left, top){ delete this.lastXY; this.lastLT = [left, top]; }, beforeFx : function(){ this.beforeAction(); return Ext.Layer.superclass.beforeFx.apply(this, arguments); }, afterFx : function(){ Ext.Layer.superclass.afterFx.apply(this, arguments); this.sync(this.isVisible()); }, beforeAction : function(){ if(!this.updating && this.shadow){ this.shadow.hide(); } }, setLeft : function(left){ this.storeLeftTop(left, this.getTop(true)); supr.setLeft.apply(this, arguments); this.sync(); }, setTop : function(top){ this.storeLeftTop(this.getLeft(true), top); supr.setTop.apply(this, arguments); this.sync(); }, setLeftTop : function(left, top){ this.storeLeftTop(left, top); supr.setLeftTop.apply(this, arguments); this.sync(); }, setXY : function(xy, a, d, c, e){ this.fixDisplay(); this.beforeAction(); this.storeXY(xy); var cb = this.createCB(c); supr.setXY.call(this, xy, a, d, cb, e); if(!a){ cb(); } }, createCB : function(c){ var el = this; return function(){ el.constrainXY(); el.sync(true); if(c){ c(); } }; }, setX : function(x, a, d, c, e){ this.setXY([x, this.getY()], a, d, c, e); }, setY : function(y, a, d, c, e){ this.setXY([this.getX(), y], a, d, c, e); }, setSize : function(w, h, a, d, c, e){ this.beforeAction(); var cb = this.createCB(c); supr.setSize.call(this, w, h, a, d, cb, e); if(!a){ cb(); } }, setWidth : function(w, a, d, c, e){ this.beforeAction(); var cb = this.createCB(c); supr.setWidth.call(this, w, a, d, cb, e); if(!a){ cb(); } }, setHeight : function(h, a, d, c, e){ this.beforeAction(); var cb = this.createCB(c); supr.setHeight.call(this, h, a, d, cb, e); if(!a){ cb(); } }, setBounds : function(x, y, w, h, a, d, c, e){ this.beforeAction(); var cb = this.createCB(c); if(!a){ this.storeXY([x, y]); supr.setXY.call(this, [x, y]); supr.setSize.call(this, w, h, a, d, cb, e); cb(); }else{ supr.setBounds.call(this, x, y, w, h, a, d, cb, e); } return this; }, setZIndex : function(zindex){ this.zindex = zindex; this.setStyle("z-index", zindex + 2); if(this.shadow){ this.shadow.setZIndex(zindex + 1); } if(this.shim){ this.shim.setStyle("z-index", zindex); } } }); })(); Ext.Shadow = function(config){ Ext.apply(this, config); if(typeof this.mode != "string"){ this.mode = this.defaultMode; } var o = this.offset, a = {h: 0}; var rad = Math.floor(this.offset/2); switch(this.mode.toLowerCase()){ case "drop": a.w = 0; a.l = a.t = o; a.t -= 1; if(Ext.isIE){ a.l -= this.offset + rad; a.t -= this.offset + rad; a.w -= rad; a.h -= rad; a.t += 1; } break; case "sides": a.w = (o*2); a.l = -o; a.t = o-1; if(Ext.isIE){ a.l -= (this.offset - rad); a.t -= this.offset + rad; a.l += 1; a.w -= (this.offset - rad)*2; a.w -= rad + 1; a.h -= 1; } break; case "frame": a.w = a.h = (o*2); a.l = a.t = -o; a.t += 1; a.h -= 2; if(Ext.isIE){ a.l -= (this.offset - rad); a.t -= (this.offset - rad); a.l += 1; a.w -= (this.offset + rad + 1); a.h -= (this.offset + rad); a.h += 1; } break; }; this.adjusts = a; }; Ext.Shadow.prototype = { offset: 4, defaultMode: "drop", show : function(target){ target = Ext.get(target); if(!this.el){ this.el = Ext.Shadow.Pool.pull(); if(this.el.dom.nextSibling != target.dom){ this.el.insertBefore(target); } } this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1); if(Ext.isIE){ this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")"; } this.realign( target.getLeft(true), target.getTop(true), target.getWidth(), target.getHeight() ); this.el.dom.style.display = "block"; }, isVisible : function(){ return this.el ? true : false; }, realign : function(l, t, w, h){ if(!this.el){ return; } var a = this.adjusts, d = this.el.dom, s = d.style; var iea = 0; s.left = (l+a.l)+"px"; s.top = (t+a.t)+"px"; var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px"; if(s.width != sws || s.height != shs){ s.width = sws; s.height = shs; if(!Ext.isIE){ var cn = d.childNodes; var sww = Math.max(0, (sw-12))+"px"; cn[0].childNodes[1].style.width = sww; cn[1].childNodes[1].style.width = sww; cn[2].childNodes[1].style.width = sww; cn[1].style.height = Math.max(0, (sh-12))+"px"; } } }, hide : function(){ if(this.el){ this.el.dom.style.display = "none"; Ext.Shadow.Pool.push(this.el); delete this.el; } }, setZIndex : function(z){ this.zIndex = z; if(this.el){ this.el.setStyle("z-index", z); } } }; Ext.Shadow.Pool = function(){ var p = []; var markup = Ext.isIE ? '<div class="x-ie-shadow"></div>' : '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>'; return { pull : function(){ var sh = p.shift(); if(!sh){ sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup)); sh.autoBoxAdjust = false; } return sh; }, push : function(sh){ p.push(sh); } }; }(); Ext.BoxComponent = Ext.extend(Ext.Component, { initComponent : function(){ Ext.BoxComponent.superclass.initComponent.call(this); this.addEvents( 'resize', 'move' ); }, boxReady : false, deferHeight: false, setSize : function(w, h){ if(typeof w == 'object'){ h = w.height; w = w.width; } if(!this.boxReady){ this.width = w; this.height = h; return this; } if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){ return this; } this.lastSize = {width: w, height: h}; var adj = this.adjustSize(w, h); var aw = adj.width, ah = adj.height; if(aw !== undefined || ah !== undefined){ var rz = this.getResizeEl(); if(!this.deferHeight && aw !== undefined && ah !== undefined){ rz.setSize(aw, ah); }else if(!this.deferHeight && ah !== undefined){ rz.setHeight(ah); }else if(aw !== undefined){ rz.setWidth(aw); } this.onResize(aw, ah, w, h); this.fireEvent('resize', this, aw, ah, w, h); } return this; }, setWidth : function(width){ return this.setSize(width); }, setHeight : function(height){ return this.setSize(undefined, height); }, getSize : function(){ return this.el.getSize(); }, getPosition : function(local){ if(local === true){ return [this.el.getLeft(true), this.el.getTop(true)]; } return this.xy || this.el.getXY(); }, getBox : function(local){ var s = this.el.getSize(); if(local === true){ s.x = this.el.getLeft(true); s.y = this.el.getTop(true); }else{ var xy = this.xy || this.el.getXY(); s.x = xy[0]; s.y = xy[1]; } return s; }, updateBox : function(box){ this.setSize(box.width, box.height); this.setPagePosition(box.x, box.y); return this; }, getResizeEl : function(){ return this.resizeEl || this.el; }, getPositionEl : function(){ return this.positionEl || this.el; }, setPosition : function(x, y){ if(x && typeof x[1] == 'number'){ y = x[1]; x = x[0]; } this.x = x; this.y = y; if(!this.boxReady){ return this; } var adj = this.adjustPosition(x, y); var ax = adj.x, ay = adj.y; var el = this.getPositionEl(); if(ax !== undefined || ay !== undefined){ if(ax !== undefined && ay !== undefined){ el.setLeftTop(ax, ay); }else if(ax !== undefined){ el.setLeft(ax); }else if(ay !== undefined){ el.setTop(ay); } this.onPosition(ax, ay); this.fireEvent('move', this, ax, ay); } return this; }, setPagePosition : function(x, y){ if(x && typeof x[1] == 'number'){ y = x[1]; x = x[0]; } this.pageX = x; this.pageY = y; if(!this.boxReady){ return; } if(x === undefined || y === undefined){ return; } var p = this.el.translatePoints(x, y); this.setPosition(p.left, p.top); return this; }, onRender : function(ct, position){ Ext.BoxComponent.superclass.onRender.call(this, ct, position); if(this.resizeEl){ this.resizeEl = Ext.get(this.resizeEl); } if(this.positionEl){ this.positionEl = Ext.get(this.positionEl); } }, afterRender : function(){ Ext.BoxComponent.superclass.afterRender.call(this); this.boxReady = true; this.setSize(this.width, this.height); if(this.x || this.y){ this.setPosition(this.x, this.y); }else if(this.pageX || this.pageY){ this.setPagePosition(this.pageX, this.pageY); } }, syncSize : function(){ delete this.lastSize; this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight()); return this; }, onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){ }, onPosition : function(x, y){ }, adjustSize : function(w, h){ if(this.autoWidth){ w = 'auto'; } if(this.autoHeight){ h = 'auto'; } return {width : w, height: h}; }, adjustPosition : function(x, y){ return {x : x, y: y}; } }); Ext.reg('box', Ext.BoxComponent); Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){ this.el = Ext.get(dragElement, true); this.el.dom.unselectable = "on"; this.resizingEl = Ext.get(resizingElement, true); this.orientation = orientation || Ext.SplitBar.HORIZONTAL; this.minSize = 0; this.maxSize = 2000; this.animate = false; this.useShim = false; this.shim = null; if(!existingProxy){ this.proxy = Ext.SplitBar.createProxy(this.orientation); }else{ this.proxy = Ext.get(existingProxy).dom; } this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id}); this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this); this.dd.endDrag = this.onEndProxyDrag.createDelegate(this); this.dragSpecs = {}; this.adapter = new Ext.SplitBar.BasicLayoutAdapter(); this.adapter.init(this); if(this.orientation == Ext.SplitBar.HORIZONTAL){ this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT); this.el.addClass("x-splitbar-h"); }else{ this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM); this.el.addClass("x-splitbar-v"); } this.addEvents( "resize", "moved", "beforeresize", "beforeapply" ); Ext.SplitBar.superclass.constructor.call(this); }; Ext.extend(Ext.SplitBar, Ext.util.Observable, { onStartProxyDrag : function(x, y){ this.fireEvent("beforeresize", this); this.overlay = Ext.DomHelper.append(document.body, {cls: "x-drag-overlay", html: "&#160;"}, true); this.overlay.unselectable(); this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true)); this.overlay.show(); Ext.get(this.proxy).setDisplayed("block"); var size = this.adapter.getElementSize(this); this.activeMinSize = this.getMinimumSize();; this.activeMaxSize = this.getMaximumSize();; var c1 = size - this.activeMinSize; var c2 = Math.max(this.activeMaxSize - size, 0); if(this.orientation == Ext.SplitBar.HORIZONTAL){ this.dd.resetConstraints(); this.dd.setXConstraint( this.placement == Ext.SplitBar.LEFT ? c1 : c2, this.placement == Ext.SplitBar.LEFT ? c2 : c1 ); this.dd.setYConstraint(0, 0); }else{ this.dd.resetConstraints(); this.dd.setXConstraint(0, 0); this.dd.setYConstraint( this.placement == Ext.SplitBar.TOP ? c1 : c2, this.placement == Ext.SplitBar.TOP ? c2 : c1 ); } this.dragSpecs.startSize = size; this.dragSpecs.startPoint = [x, y]; Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y); }, onEndProxyDrag : function(e){ Ext.get(this.proxy).setDisplayed(false); var endPoint = Ext.lib.Event.getXY(e); if(this.overlay){ this.overlay.remove(); delete this.overlay; } var newSize; if(this.orientation == Ext.SplitBar.HORIZONTAL){ newSize = this.dragSpecs.startSize + (this.placement == Ext.SplitBar.LEFT ? endPoint[0] - this.dragSpecs.startPoint[0] : this.dragSpecs.startPoint[0] - endPoint[0] ); }else{ newSize = this.dragSpecs.startSize + (this.placement == Ext.SplitBar.TOP ? endPoint[1] - this.dragSpecs.startPoint[1] : this.dragSpecs.startPoint[1] - endPoint[1] ); } newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize); if(newSize != this.dragSpecs.startSize){ if(this.fireEvent('beforeapply', this, newSize) !== false){ this.adapter.setElementSize(this, newSize); this.fireEvent("moved", this, newSize); this.fireEvent("resize", this, newSize); } } }, getAdapter : function(){ return this.adapter; }, setAdapter : function(adapter){ this.adapter = adapter; this.adapter.init(this); }, getMinimumSize : function(){ return this.minSize; }, setMinimumSize : function(minSize){ this.minSize = minSize; }, getMaximumSize : function(){ return this.maxSize; }, setMaximumSize : function(maxSize){ this.maxSize = maxSize; }, setCurrentSize : function(size){ var oldAnimate = this.animate; this.animate = false; this.adapter.setElementSize(this, size); this.animate = oldAnimate; }, destroy : function(removeEl){ if(this.shim){ this.shim.remove(); } this.dd.unreg(); Ext.removeNode(this.proxy); if(removeEl){ this.el.remove(); } } }); Ext.SplitBar.createProxy = function(dir){ var proxy = new Ext.Element(document.createElement("div")); proxy.unselectable(); var cls = 'x-splitbar-proxy'; proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v')); document.body.appendChild(proxy.dom); return proxy.dom; }; Ext.SplitBar.BasicLayoutAdapter = function(){ }; Ext.SplitBar.BasicLayoutAdapter.prototype = { init : function(s){ }, getElementSize : function(s){ if(s.orientation == Ext.SplitBar.HORIZONTAL){ return s.resizingEl.getWidth(); }else{ return s.resizingEl.getHeight(); } }, setElementSize : function(s, newSize, onComplete){ if(s.orientation == Ext.SplitBar.HORIZONTAL){ if(!s.animate){ s.resizingEl.setWidth(newSize); if(onComplete){ onComplete(s, newSize); } }else{ s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut'); } }else{ if(!s.animate){ s.resizingEl.setHeight(newSize); if(onComplete){ onComplete(s, newSize); } }else{ s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut'); } } } }; Ext.SplitBar.AbsoluteLayoutAdapter = function(container){ this.basic = new Ext.SplitBar.BasicLayoutAdapter(); this.container = Ext.get(container); }; Ext.SplitBar.AbsoluteLayoutAdapter.prototype = { init : function(s){ this.basic.init(s); }, getElementSize : function(s){ return this.basic.getElementSize(s); }, setElementSize : function(s, newSize, onComplete){ this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s])); }, moveSplitter : function(s){ var yes = Ext.SplitBar; switch(s.placement){ case yes.LEFT: s.el.setX(s.resizingEl.getRight()); break; case yes.RIGHT: s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px"); break; case yes.TOP: s.el.setY(s.resizingEl.getBottom()); break; case yes.BOTTOM: s.el.setY(s.resizingEl.getTop() - s.el.getHeight()); break; } } }; Ext.SplitBar.VERTICAL = 1; Ext.SplitBar.HORIZONTAL = 2; Ext.SplitBar.LEFT = 1; Ext.SplitBar.RIGHT = 2; Ext.SplitBar.TOP = 3; Ext.SplitBar.BOTTOM = 4; Ext.Container = Ext.extend(Ext.BoxComponent, { autoDestroy: true, defaultType: 'panel', initComponent : function(){ Ext.Container.superclass.initComponent.call(this); this.addEvents( 'afterlayout', 'beforeadd', 'beforeremove', 'add', 'remove' ); var items = this.items; if(items){ delete this.items; if(Ext.isArray(items)){ this.add.apply(this, items); }else{ this.add(items); } } }, initItems : function(){ if(!this.items){ this.items = new Ext.util.MixedCollection(false, this.getComponentId); this.getLayout(); } }, setLayout : function(layout){ if(this.layout && this.layout != layout){ this.layout.setContainer(null); } this.initItems(); this.layout = layout; layout.setContainer(this); }, render : function(){ Ext.Container.superclass.render.apply(this, arguments); if(this.layout){ if(typeof this.layout == 'string'){ this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig); } this.setLayout(this.layout); if(this.activeItem !== undefined){ var item = this.activeItem; delete this.activeItem; this.layout.setActiveItem(item); return; } } if(!this.ownerCt){ this.doLayout(); } if(this.monitorResize === true){ Ext.EventManager.onWindowResize(this.doLayout, this, [false]); } }, getLayoutTarget : function(){ return this.el; }, getComponentId : function(comp){ return comp.itemId || comp.id; }, add : function(comp){ if(!this.items){ this.initItems(); } var a = arguments, len = a.length; if(len > 1){ for(var i = 0; i < len; i++) { this.add(a[i]); } return; } var c = this.lookupComponent(this.applyDefaults(comp)); var pos = this.items.length; if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){ this.items.add(c); c.ownerCt = this; this.fireEvent('add', this, c, pos); } return c; }, insert : function(index, comp){ if(!this.items){ this.initItems(); } var a = arguments, len = a.length; if(len > 2){ for(var i = len-1; i >= 1; --i) { this.insert(index, a[i]); } return; } var c = this.lookupComponent(this.applyDefaults(comp)); if(c.ownerCt == this && this.items.indexOf(c) < index){ --index; } if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){ this.items.insert(index, c); c.ownerCt = this; this.fireEvent('add', this, c, index); } return c; }, applyDefaults : function(c){ if(this.defaults){ if(typeof c == 'string'){ c = Ext.ComponentMgr.get(c); Ext.apply(c, this.defaults); }else if(!c.events){ Ext.applyIf(c, this.defaults); }else{ Ext.apply(c, this.defaults); } } return c; }, onBeforeAdd : function(item){ if(item.ownerCt){ item.ownerCt.remove(item, false); } if(this.hideBorders === true){ item.border = (item.border === true); } }, remove : function(comp, autoDestroy){ var c = this.getComponent(comp); if(c && this.fireEvent('beforeremove', this, c) !== false){ this.items.remove(c); delete c.ownerCt; if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){ c.destroy(); } if(this.layout && this.layout.activeItem == c){ delete this.layout.activeItem; } this.fireEvent('remove', this, c); } return c; }, getComponent : function(comp){ if(typeof comp == 'object'){ return comp; } return this.items.get(comp); }, lookupComponent : function(comp){ if(typeof comp == 'string'){ return Ext.ComponentMgr.get(comp); }else if(!comp.events){ return this.createComponent(comp); } return comp; }, createComponent : function(config){ return Ext.ComponentMgr.create(config, this.defaultType); }, doLayout : function(shallow){ if(this.rendered && this.layout){ this.layout.layout(); } if(shallow !== false && this.items){ var cs = this.items.items; for(var i = 0, len = cs.length; i < len; i++) { var c = cs[i]; if(c.doLayout){ c.doLayout(); } } } }, getLayout : function(){ if(!this.layout){ var layout = new Ext.layout.ContainerLayout(this.layoutConfig); this.setLayout(layout); } return this.layout; }, onDestroy : function(){ if(this.items){ var cs = this.items.items; for(var i = 0, len = cs.length; i < len; i++) { Ext.destroy(cs[i]); } } if(this.monitorResize){ Ext.EventManager.removeResizeListener(this.doLayout, this); } Ext.Container.superclass.onDestroy.call(this); }, bubble : function(fn, scope, args){ var p = this; while(p){ if(fn.apply(scope || p, args || [p]) === false){ break; } p = p.ownerCt; } }, cascade : function(fn, scope, args){ if(fn.apply(scope || this, args || [this]) !== false){ if(this.items){ var cs = this.items.items; for(var i = 0, len = cs.length; i < len; i++){ if(cs[i].cascade){ cs[i].cascade(fn, scope, args); }else{ fn.apply(scope || this, args || [cs[i]]); } } } } }, findById : function(id){ var m, ct = this; this.cascade(function(c){ if(ct != c && c.id === id){ m = c; return false; } }); return m || null; }, findByType : function(xtype){ return typeof xtype == 'function' ? this.findBy(function(c){ return c.constructor === xtype; }) : this.findBy(function(c){ return c.constructor.xtype === xtype; }); }, find : function(prop, value){ return this.findBy(function(c){ return c[prop] === value; }); }, findBy : function(fn, scope){ var m = [], ct = this; this.cascade(function(c){ if(ct != c && fn.call(scope || c, c, ct) === true){ m.push(c); } }); return m; } }); Ext.Container.LAYOUTS = {}; Ext.reg('container', Ext.Container); Ext.layout.ContainerLayout = function(config){ Ext.apply(this, config); }; Ext.layout.ContainerLayout.prototype = { monitorResize:false, activeItem : null, layout : function(){ var target = this.container.getLayoutTarget(); this.onLayout(this.container, target); this.container.fireEvent('afterlayout', this.container, this); }, onLayout : function(ct, target){ this.renderAll(ct, target); }, isValidParent : function(c, target){ var el = c.getPositionEl ? c.getPositionEl() : c.getEl(); return el.dom.parentNode == target.dom; }, renderAll : function(ct, target){ var items = ct.items.items; for(var i = 0, len = items.length; i < len; i++) { var c = items[i]; if(c && (!c.rendered || !this.isValidParent(c, target))){ this.renderItem(c, i, target); } } }, renderItem : function(c, position, target){ if(c && !c.rendered){ c.render(target, position); if(this.extraCls){ var t = c.getPositionEl ? c.getPositionEl() : c; t.addClass(this.extraCls); } if (this.renderHidden && c != this.activeItem) { c.hide(); } }else if(c && !this.isValidParent(c, target)){ if(this.extraCls){ c.addClass(this.extraCls); } if(typeof position == 'number'){ position = target.dom.childNodes[position]; } target.dom.insertBefore(c.getEl().dom, position || null); if (this.renderHidden && c != this.activeItem) { c.hide(); } } }, onResize: function(){ if(this.container.collapsed){ return; } var b = this.container.bufferResize; if(b){ if(!this.resizeTask){ this.resizeTask = new Ext.util.DelayedTask(this.layout, this); this.resizeBuffer = typeof b == 'number' ? b : 100; } this.resizeTask.delay(this.resizeBuffer); }else{ this.layout(); } }, setContainer : function(ct){ if(this.monitorResize && ct != this.container){ if(this.container){ this.container.un('resize', this.onResize, this); } if(ct){ ct.on('resize', this.onResize, this); } } this.container = ct; }, parseMargins : function(v){ var ms = v.split(' '); var len = ms.length; if(len == 1){ ms[1] = ms[0]; ms[2] = ms[0]; ms[3] = ms[0]; } if(len == 2){ ms[2] = ms[0]; ms[3] = ms[1]; } return { top:parseInt(ms[0], 10) || 0, right:parseInt(ms[1], 10) || 0, bottom:parseInt(ms[2], 10) || 0, left:parseInt(ms[3], 10) || 0 }; } }; Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout; Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, { monitorResize:true, onLayout : function(ct, target){ Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target); if(!this.container.collapsed){ this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize()); } }, setItemSize : function(item, size){ if(item && size.height > 0){ item.setSize(size); } } }); Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout; Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, { deferredRender : false, renderHidden : true, setActiveItem : function(item){ item = this.container.getComponent(item); if(this.activeItem != item){ if(this.activeItem){ this.activeItem.hide(); } this.activeItem = item; item.show(); this.layout(); } }, renderAll : function(ct, target){ if(this.deferredRender){ this.renderItem(this.activeItem, undefined, target); }else{ Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target); } } }); Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout; Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, { monitorResize:true, getAnchorViewSize : function(ct, target){ return target.dom == document.body ? target.getViewSize() : target.getStyleSize(); }, onLayout : function(ct, target){ Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target); var size = this.getAnchorViewSize(ct, target); var w = size.width, h = size.height; if(w < 20 || h < 20){ return; } var aw, ah; if(ct.anchorSize){ if(typeof ct.anchorSize == 'number'){ aw = ct.anchorSize; }else{ aw = ct.anchorSize.width; ah = ct.anchorSize.height; } }else{ aw = ct.initialConfig.width; ah = ct.initialConfig.height; } var cs = ct.items.items, len = cs.length, i, c, a, cw, ch; for(i = 0; i < len; i++){ c = cs[i]; if(c.anchor){ a = c.anchorSpec; if(!a){ var vs = c.anchor.split(' '); c.anchorSpec = a = { right: this.parseAnchor(vs[0], c.initialConfig.width, aw), bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah) }; } cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined; ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined; if(cw || ch){ c.setSize(cw || undefined, ch || undefined); } } } }, parseAnchor : function(a, start, cstart){ if(a && a != 'none'){ var last; if(/^(r|right|b|bottom)$/i.test(a)){ var diff = cstart - start; return function(v){ if(v !== last){ last = v; return v - diff; } } }else if(a.indexOf('%') != -1){ var ratio = parseFloat(a.replace('%', ''))*.01; return function(v){ if(v !== last){ last = v; return Math.floor(v*ratio); } } }else{ a = parseInt(a, 10); if(!isNaN(a)){ return function(v){ if(v !== last){ last = v; return v + a; } } } } } return false; }, adjustWidthAnchor : function(value, comp){ return value; }, adjustHeightAnchor : function(value, comp){ return value; } }); Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout; Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, { monitorResize:true, extraCls: 'x-column', scrollOffset : 0, isValidParent : function(c, target){ return c.getEl().dom.parentNode == this.innerCt.dom; }, onLayout : function(ct, target){ var cs = ct.items.items, len = cs.length, c, i; if(!this.innerCt){ target.addClass('x-column-layout-ct'); this.innerCt = target.createChild({cls:'x-column-inner'}); this.innerCt.createChild({cls:'x-clear'}); } this.renderAll(ct, this.innerCt); var size = target.getViewSize(); if(size.width < 1 && size.height < 1){ return; } var w = size.width - target.getPadding('lr') - this.scrollOffset, h = size.height - target.getPadding('tb'), pw = w; this.innerCt.setWidth(w); for(i = 0; i < len; i++){ c = cs[i]; if(!c.columnWidth){ pw -= (c.getSize().width + c.getEl().getMargins('lr')); } } pw = pw < 0 ? 0 : pw; for(i = 0; i < len; i++){ c = cs[i]; if(c.columnWidth){ c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr')); } } } }); Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout; Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, { monitorResize:true, rendered : false, onLayout : function(ct, target){ var collapsed; if(!this.rendered){ target.position(); target.addClass('x-border-layout-ct'); var items = ct.items.items; collapsed = []; for(var i = 0, len = items.length; i < len; i++) { var c = items[i]; var pos = c.region; if(c.collapsed){ collapsed.push(c); } c.collapsed = false; if(!c.rendered){ c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel'; c.render(target, i); } this[pos] = pos != 'center' && c.split ? new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) : new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos); this[pos].render(target, c); } this.rendered = true; } var size = target.getViewSize(); if(size.width < 20 || size.height < 20){ if(collapsed){ this.restoreCollapsed = collapsed; } return; }else if(this.restoreCollapsed){ collapsed = this.restoreCollapsed; delete this.restoreCollapsed; } var w = size.width, h = size.height; var centerW = w, centerH = h, centerY = 0, centerX = 0; var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center; if(!c){ throw 'No center region defined in BorderLayout ' + ct.id; } if(n && n.isVisible()){ var b = n.getSize(); var m = n.getMargins(); b.width = w - (m.left+m.right); b.x = m.left; b.y = m.top; centerY = b.height + b.y + m.bottom; centerH -= centerY; n.applyLayout(b); } if(s && s.isVisible()){ var b = s.getSize(); var m = s.getMargins(); b.width = w - (m.left+m.right); b.x = m.left; var totalHeight = (b.height + m.top + m.bottom); b.y = h - totalHeight + m.top; centerH -= totalHeight; s.applyLayout(b); } if(west && west.isVisible()){ var b = west.getSize(); var m = west.getMargins(); b.height = centerH - (m.top+m.bottom); b.x = m.left; b.y = centerY + m.top; var totalWidth = (b.width + m.left + m.right); centerX += totalWidth; centerW -= totalWidth; west.applyLayout(b); } if(e && e.isVisible()){ var b = e.getSize(); var m = e.getMargins(); b.height = centerH - (m.top+m.bottom); var totalWidth = (b.width + m.left + m.right); b.x = w - totalWidth + m.left; b.y = centerY + m.top; centerW -= totalWidth; e.applyLayout(b); } var m = c.getMargins(); var centerBox = { x: centerX + m.left, y: centerY + m.top, width: centerW - (m.left+m.right), height: centerH - (m.top+m.bottom) }; c.applyLayout(centerBox); if(collapsed){ for(var i = 0, len = collapsed.length; i < len; i++){ collapsed[i].collapse(false); } } if(Ext.isIE && Ext.isStrict){ target.repaint(); } } }); Ext.layout.BorderLayout.Region = function(layout, config, pos){ Ext.apply(this, config); this.layout = layout; this.position = pos; this.state = {}; if(typeof this.margins == 'string'){ this.margins = this.layout.parseMargins(this.margins); } this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins); if(this.collapsible){ if(typeof this.cmargins == 'string'){ this.cmargins = this.layout.parseMargins(this.cmargins); } if(this.collapseMode == 'mini' && !this.cmargins){ this.cmargins = {left:0,top:0,right:0,bottom:0}; }else{ this.cmargins = Ext.applyIf(this.cmargins || {}, pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins); } } }; Ext.layout.BorderLayout.Region.prototype = { collapsible : false, split:false, floatable: true, minWidth:50, minHeight:50, defaultMargins : {left:0,top:0,right:0,bottom:0}, defaultNSCMargins : {left:5,top:5,right:5,bottom:5}, defaultEWCMargins : {left:5,top:0,right:5,bottom:0}, isCollapsed : false, render : function(ct, p){ this.panel = p; p.el.enableDisplayMode(); this.targetEl = ct; this.el = p.el; var gs = p.getState, ps = this.position; p.getState = function(){ return Ext.apply(gs.call(p) || {}, this.state); }.createDelegate(this); if(ps != 'center'){ p.allowQueuedExpand = false; p.on({ beforecollapse: this.beforeCollapse, collapse: this.onCollapse, beforeexpand: this.beforeExpand, expand: this.onExpand, hide: this.onHide, show: this.onShow, scope: this }); if(this.collapsible){ p.collapseEl = 'el'; p.slideAnchor = this.getSlideAnchor(); } if(p.tools && p.tools.toggle){ p.tools.toggle.addClass('x-tool-collapse-'+ps); p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over'); } } }, getCollapsedEl : function(){ if(!this.collapsedEl){ if(!this.toolTemplate){ var tt = new Ext.Template( '<div class="x-tool x-tool-{id}">&#160;</div>' ); tt.disableFormats = true; tt.compile(); Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt; } this.collapsedEl = this.targetEl.createChild({ cls: "x-layout-collapsed x-layout-collapsed-"+this.position, id: this.panel.id + '-xcollapsed' }); this.collapsedEl.enableDisplayMode('block'); if(this.collapseMode == 'mini'){ this.collapsedEl.addClass('x-layout-cmini-'+this.position); this.miniCollapsedEl = this.collapsedEl.createChild({ cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;" }); this.miniCollapsedEl.addClassOnOver('x-layout-mini-over'); this.collapsedEl.addClassOnOver("x-layout-collapsed-over"); this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true}); }else { var t = this.toolTemplate.append( this.collapsedEl.dom, {id:'expand-'+this.position}, true); t.addClassOnOver('x-tool-expand-'+this.position+'-over'); t.on('click', this.onExpandClick, this, {stopEvent:true}); if(this.floatable !== false){ this.collapsedEl.addClassOnOver("x-layout-collapsed-over"); this.collapsedEl.on("click", this.collapseClick, this); } } } return this.collapsedEl; }, onExpandClick : function(e){ if(this.isSlid){ this.afterSlideIn(); this.panel.expand(false); }else{ this.panel.expand(); } }, onCollapseClick : function(e){ this.panel.collapse(); }, beforeCollapse : function(p, animate){ this.lastAnim = animate; if(this.splitEl){ this.splitEl.hide(); } this.getCollapsedEl().show(); this.panel.el.setStyle('z-index', 100); this.isCollapsed = true; this.layout.layout(); }, onCollapse : function(animate){ this.panel.el.setStyle('z-index', 1); if(this.lastAnim === false || this.panel.animCollapse === false){ this.getCollapsedEl().dom.style.visibility = 'visible'; }else{ this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2}); } this.state.collapsed = true; this.panel.saveState(); }, beforeExpand : function(animate){ var c = this.getCollapsedEl(); this.el.show(); if(this.position == 'east' || this.position == 'west'){ this.panel.setSize(undefined, c.getHeight()); }else{ this.panel.setSize(c.getWidth(), undefined); } c.hide(); c.dom.style.visibility = 'hidden'; this.panel.el.setStyle('z-index', 100); }, onExpand : function(){ this.isCollapsed = false; if(this.splitEl){ this.splitEl.show(); } this.layout.layout(); this.panel.el.setStyle('z-index', 1); this.state.collapsed = false; this.panel.saveState(); }, collapseClick : function(e){ if(this.isSlid){ e.stopPropagation(); this.slideIn(); }else{ e.stopPropagation(); this.slideOut(); } }, onHide : function(){ if(this.isCollapsed){ this.getCollapsedEl().hide(); }else if(this.splitEl){ this.splitEl.hide(); } }, onShow : function(){ if(this.isCollapsed){ this.getCollapsedEl().show(); }else if(this.splitEl){ this.splitEl.show(); } }, isVisible : function(){ return !this.panel.hidden; }, getMargins : function(){ return this.isCollapsed && this.cmargins ? this.cmargins : this.margins; }, getSize : function(){ return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize(); }, setPanel : function(panel){ this.panel = panel; }, getMinWidth: function(){ return this.minWidth; }, getMinHeight: function(){ return this.minHeight; }, applyLayoutCollapsed : function(box){ var ce = this.getCollapsedEl(); ce.setLeftTop(box.x, box.y); ce.setSize(box.width, box.height); }, applyLayout : function(box){ if(this.isCollapsed){ this.applyLayoutCollapsed(box); }else{ this.panel.setPosition(box.x, box.y); this.panel.setSize(box.width, box.height); } }, beforeSlide: function(){ this.panel.beforeEffect(); }, afterSlide : function(){ this.panel.afterEffect(); }, initAutoHide : function(){ if(this.autoHide !== false){ if(!this.autoHideHd){ var st = new Ext.util.DelayedTask(this.slideIn, this); this.autoHideHd = { "mouseout": function(e){ if(!e.within(this.el, true)){ st.delay(500); } }, "mouseover" : function(e){ st.cancel(); }, scope : this }; } this.el.on(this.autoHideHd); } }, clearAutoHide : function(){ if(this.autoHide !== false){ this.el.un("mouseout", this.autoHideHd.mouseout); this.el.un("mouseover", this.autoHideHd.mouseover); } }, clearMonitor : function(){ Ext.getDoc().un("click", this.slideInIf, this); }, slideOut : function(){ if(this.isSlid || this.el.hasActiveFx()){ return; } this.isSlid = true; var ts = this.panel.tools; if(ts && ts.toggle){ ts.toggle.hide(); } this.el.show(); if(this.position == 'east' || this.position == 'west'){ this.panel.setSize(undefined, this.collapsedEl.getHeight()); }else{ this.panel.setSize(this.collapsedEl.getWidth(), undefined); } this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top]; this.el.alignTo(this.collapsedEl, this.getCollapseAnchor()); this.el.setStyle("z-index", 102); if(this.animFloat !== false){ this.beforeSlide(); this.el.slideIn(this.getSlideAnchor(), { callback: function(){ this.afterSlide(); this.initAutoHide(); Ext.getDoc().on("click", this.slideInIf, this); }, scope: this, block: true }); }else{ this.initAutoHide(); Ext.getDoc().on("click", this.slideInIf, this); } }, afterSlideIn : function(){ this.clearAutoHide(); this.isSlid = false; this.clearMonitor(); this.el.setStyle("z-index", ""); this.el.dom.style.left = this.restoreLT[0]; this.el.dom.style.top = this.restoreLT[1]; var ts = this.panel.tools; if(ts && ts.toggle){ ts.toggle.show(); } }, slideIn : function(cb){ if(!this.isSlid || this.el.hasActiveFx()){ Ext.callback(cb); return; } this.isSlid = false; if(this.animFloat !== false){ this.beforeSlide(); this.el.slideOut(this.getSlideAnchor(), { callback: function(){ this.el.hide(); this.afterSlide(); this.afterSlideIn(); Ext.callback(cb); }, scope: this, block: true }); }else{ this.el.hide(); this.afterSlideIn(); } }, slideInIf : function(e){ if(!e.within(this.el)){ this.slideIn(); } }, anchors : { "west" : "left", "east" : "right", "north" : "top", "south" : "bottom" }, sanchors : { "west" : "l", "east" : "r", "north" : "t", "south" : "b" }, canchors : { "west" : "tl-tr", "east" : "tr-tl", "north" : "tl-bl", "south" : "bl-tl" }, getAnchor : function(){ return this.anchors[this.position]; }, getCollapseAnchor : function(){ return this.canchors[this.position]; }, getSlideAnchor : function(){ return this.sanchors[this.position]; }, getAlignAdj : function(){ var cm = this.cmargins; switch(this.position){ case "west": return [0, 0]; break; case "east": return [0, 0]; break; case "north": return [0, 0]; break; case "south": return [0, 0]; break; } }, getExpandAdj : function(){ var c = this.collapsedEl, cm = this.cmargins; switch(this.position){ case "west": return [-(cm.right+c.getWidth()+cm.left), 0]; break; case "east": return [cm.right+c.getWidth()+cm.left, 0]; break; case "north": return [0, -(cm.top+cm.bottom+c.getHeight())]; break; case "south": return [0, cm.top+cm.bottom+c.getHeight()]; break; } } }; Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){ Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos); this.applyLayout = this.applyFns[pos]; }; Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, { splitTip : "Drag to resize.", collapsibleSplitTip : "Drag to resize. Double click to hide.", useSplitTips : false, splitSettings : { north : { orientation: Ext.SplitBar.VERTICAL, placement: Ext.SplitBar.TOP, maxFn : 'getVMaxSize', minProp: 'minHeight', maxProp: 'maxHeight' }, south : { orientation: Ext.SplitBar.VERTICAL, placement: Ext.SplitBar.BOTTOM, maxFn : 'getVMaxSize', minProp: 'minHeight', maxProp: 'maxHeight' }, east : { orientation: Ext.SplitBar.HORIZONTAL, placement: Ext.SplitBar.RIGHT, maxFn : 'getHMaxSize', minProp: 'minWidth', maxProp: 'maxWidth' }, west : { orientation: Ext.SplitBar.HORIZONTAL, placement: Ext.SplitBar.LEFT, maxFn : 'getHMaxSize', minProp: 'minWidth', maxProp: 'maxWidth' } }, applyFns : { west : function(box){ if(this.isCollapsed){ return this.applyLayoutCollapsed(box); } var sd = this.splitEl.dom, s = sd.style; this.panel.setPosition(box.x, box.y); var sw = sd.offsetWidth; s.left = (box.x+box.width-sw)+'px'; s.top = (box.y)+'px'; s.height = Math.max(0, box.height)+'px'; this.panel.setSize(box.width-sw, box.height); }, east : function(box){ if(this.isCollapsed){ return this.applyLayoutCollapsed(box); } var sd = this.splitEl.dom, s = sd.style; var sw = sd.offsetWidth; this.panel.setPosition(box.x+sw, box.y); s.left = (box.x)+'px'; s.top = (box.y)+'px'; s.height = Math.max(0, box.height)+'px'; this.panel.setSize(box.width-sw, box.height); }, north : function(box){ if(this.isCollapsed){ return this.applyLayoutCollapsed(box); } var sd = this.splitEl.dom, s = sd.style; var sh = sd.offsetHeight; this.panel.setPosition(box.x, box.y); s.left = (box.x)+'px'; s.top = (box.y+box.height-sh)+'px'; s.width = Math.max(0, box.width)+'px'; this.panel.setSize(box.width, box.height-sh); }, south : function(box){ if(this.isCollapsed){ return this.applyLayoutCollapsed(box); } var sd = this.splitEl.dom, s = sd.style; var sh = sd.offsetHeight; this.panel.setPosition(box.x, box.y+sh); s.left = (box.x)+'px'; s.top = (box.y)+'px'; s.width = Math.max(0, box.width)+'px'; this.panel.setSize(box.width, box.height-sh); } }, render : function(ct, p){ Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p); var ps = this.position; this.splitEl = ct.createChild({ cls: "x-layout-split x-layout-split-"+ps, html: "&#160;", id: this.panel.id + '-xsplit' }); if(this.collapseMode == 'mini'){ this.miniSplitEl = this.splitEl.createChild({ cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;" }); this.miniSplitEl.addClassOnOver('x-layout-mini-over'); this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true}); } var s = this.splitSettings[ps]; this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation); this.split.placement = s.placement; this.split.getMaximumSize = this[s.maxFn].createDelegate(this); this.split.minSize = this.minSize || this[s.minProp]; this.split.on("beforeapply", this.onSplitMove, this); this.split.useShim = this.useShim === true; this.maxSize = this.maxSize || this[s.maxProp]; if(p.hidden){ this.splitEl.hide(); } if(this.useSplitTips){ this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip; } if(this.collapsible){ this.splitEl.on("dblclick", this.onCollapseClick, this); } }, getSize : function(){ if(this.isCollapsed){ return this.collapsedEl.getSize(); } var s = this.panel.getSize(); if(this.position == 'north' || this.position == 'south'){ s.height += this.splitEl.dom.offsetHeight; }else{ s.width += this.splitEl.dom.offsetWidth; } return s; }, getHMaxSize : function(){ var cmax = this.maxSize || 10000; var center = this.layout.center; return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth()); }, getVMaxSize : function(){ var cmax = this.maxSize || 10000; var center = this.layout.center; return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight()); }, onSplitMove : function(split, newSize){ var s = this.panel.getSize(); this.lastSplitSize = newSize; if(this.position == 'north' || this.position == 'south'){ this.panel.setSize(s.width, newSize); this.state.height = newSize; }else{ this.panel.setSize(newSize, s.height); this.state.width = newSize; } this.layout.layout(); this.panel.saveState(); return false; }, getSplitBar : function(){ return this.split; } }); Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout; Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, { labelSeparator : ':', getAnchorViewSize : function(ct, target){ return ct.body.getStyleSize(); }, setContainer : function(ct){ Ext.layout.FormLayout.superclass.setContainer.call(this, ct); if(ct.labelAlign){ ct.addClass('x-form-label-'+ct.labelAlign); } if(ct.hideLabels){ this.labelStyle = "display:none"; this.elementStyle = "padding-left:0;"; this.labelAdjust = 0; }else{ this.labelSeparator = ct.labelSeparator || this.labelSeparator; ct.labelWidth = ct.labelWidth || 100; if(typeof ct.labelWidth == 'number'){ var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5); this.labelAdjust = ct.labelWidth+pad; this.labelStyle = "width:"+ct.labelWidth+"px;"; this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px'; } if(ct.labelAlign == 'top'){ this.labelStyle = "width:auto;"; this.labelAdjust = 0; this.elementStyle = "padding-left:0;"; } } if(!this.fieldTpl){ var t = new Ext.Template( '<div class="x-form-item {5}" tabIndex="-1">', '<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>', '<div class="x-form-element" id="x-form-el-{0}" style="{3}">', '</div><div class="{6}"></div>', '</div>' ); t.disableFormats = true; t.compile(); Ext.layout.FormLayout.prototype.fieldTpl = t; } }, renderItem : function(c, position, target){ if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){ var args = [ c.id, c.fieldLabel, c.labelStyle||this.labelStyle||'', this.elementStyle||'', typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator, (c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''), c.clearCls || 'x-form-clear-left' ]; if(typeof position == 'number'){ position = target.dom.childNodes[position] || null; } if(position){ this.fieldTpl.insertBefore(position, args); }else{ this.fieldTpl.append(target, args); } c.render('x-form-el-'+c.id); }else { Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments); } }, adjustWidthAnchor : function(value, comp){ return value - (comp.isFormField ? (comp.hideLabel ? 0 : this.labelAdjust) : 0); }, isValidParent : function(c, target){ return true; } }); Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout; Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, { fill : true, autoWidth : true, titleCollapse : true, hideCollapseTool : false, collapseFirst : false, animate : false, sequence : false, activeOnTop : false, renderItem : function(c){ if(this.animate === false){ c.animCollapse = false; } c.collapsible = true; if(this.autoWidth){ c.autoWidth = true; } if(this.titleCollapse){ c.titleCollapse = true; } if(this.hideCollapseTool){ c.hideCollapseTool = true; } if(this.collapseFirst !== undefined){ c.collapseFirst = this.collapseFirst; } if(!this.activeItem && !c.collapsed){ this.activeItem = c; }else if(this.activeItem){ c.collapsed = true; } Ext.layout.Accordion.superclass.renderItem.apply(this, arguments); c.header.addClass('x-accordion-hd'); c.on('beforeexpand', this.beforeExpand, this); }, beforeExpand : function(p, anim){ var ai = this.activeItem; if(ai){ if(this.sequence){ delete this.activeItem; ai.collapse({callback:function(){ p.expand(anim || true); }, scope: this}); return false; }else{ ai.collapse(this.animate); } } this.activeItem = p; if(this.activeOnTop){ p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild); } this.layout(); }, setItemSize : function(item, size){ if(this.fill && item){ var items = this.container.items.items; var hh = 0; for(var i = 0, len = items.length; i < len; i++){ var p = items[i]; if(p != item){ hh += (p.getSize().height - p.bwrap.getHeight()); } } size.height -= hh; item.setSize(size); } } }); Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion; Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, { monitorResize:false, setContainer : function(ct){ Ext.layout.TableLayout.superclass.setContainer.call(this, ct); this.currentRow = 0; this.currentColumn = 0; this.cells = []; }, onLayout : function(ct, target){ var cs = ct.items.items, len = cs.length, c, i; if(!this.table){ target.addClass('x-table-layout-ct'); this.table = target.createChild( {tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true); this.renderAll(ct, target); } }, getRow : function(index){ var row = this.table.tBodies[0].childNodes[index]; if(!row){ row = document.createElement('tr'); this.table.tBodies[0].appendChild(row); } return row; }, getNextCell : function(c){ var cell = this.getNextNonSpan(this.currentColumn, this.currentRow); var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1]; for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){ if(!this.cells[rowIndex]){ this.cells[rowIndex] = []; } for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){ this.cells[rowIndex][colIndex] = true; } } var td = document.createElement('td'); if(c.cellId){ td.id = c.cellId; } var cls = 'x-table-layout-cell'; if(c.cellCls){ cls += ' ' + c.cellCls; } td.className = cls; if(c.colspan){ td.colSpan = c.colspan; } if(c.rowspan){ td.rowSpan = c.rowspan; } this.getRow(curRow).appendChild(td); return td; }, getNextNonSpan: function(colIndex, rowIndex){ var cols = this.columns; while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) { if(cols && colIndex >= cols){ rowIndex++; colIndex = 0; }else{ colIndex++; } } return [colIndex, rowIndex]; }, renderItem : function(c, position, target){ if(c && !c.rendered){ c.render(this.getNextCell(c)); } }, isValidParent : function(c, target){ return true; } }); Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout; Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, { extraCls: 'x-abs-layout-item', isForm: false, setContainer : function(ct){ Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct); if(ct.isXType('form')){ this.isForm = true; } }, onLayout : function(ct, target){ if(this.isForm){ ct.body.position(); } else { target.position(); } Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target); }, getAnchorViewSize : function(ct, target){ return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target); }, isValidParent : function(c, target){ return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target); }, adjustWidthAnchor : function(value, comp){ return value ? value - comp.getPosition(true)[0] : value; }, adjustHeightAnchor : function(value, comp){ return value ? value - comp.getPosition(true)[1] : value; } }); Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout; Ext.Viewport = Ext.extend(Ext.Container, { initComponent : function() { Ext.Viewport.superclass.initComponent.call(this); document.getElementsByTagName('html')[0].className += ' x-viewport'; this.el = Ext.getBody(); this.el.setHeight = Ext.emptyFn; this.el.setWidth = Ext.emptyFn; this.el.setSize = Ext.emptyFn; this.el.dom.scroll = 'no'; this.allowDomMove = false; this.autoWidth = true; this.autoHeight = true; Ext.EventManager.onWindowResize(this.fireResize, this); this.renderTo = this.el; }, fireResize : function(w, h){ this.fireEvent('resize', this, w, h, w, h); } }); Ext.reg('viewport', Ext.Viewport); Ext.Panel = Ext.extend(Ext.Container, { baseCls : 'x-panel', collapsedCls : 'x-panel-collapsed', maskDisabled: true, animCollapse: Ext.enableFx, headerAsText: true, buttonAlign: 'right', collapsed : false, collapseFirst: true, minButtonWidth:75, elements : 'body', toolTarget : 'header', collapseEl : 'bwrap', slideAnchor : 't', deferHeight: true, expandDefaults: { duration:.25 }, collapseDefaults: { duration:.25 }, initComponent : function(){ Ext.Panel.superclass.initComponent.call(this); this.addEvents( 'bodyresize', 'titlechange', 'collapse', 'expand', 'beforecollapse', 'beforeexpand', 'beforeclose', 'close', 'activate', 'deactivate' ); if(this.tbar){ this.elements += ',tbar'; if(typeof this.tbar == 'object'){ this.topToolbar = this.tbar; } delete this.tbar; } if(this.bbar){ this.elements += ',bbar'; if(typeof this.bbar == 'object'){ this.bottomToolbar = this.bbar; } delete this.bbar; } if(this.header === true){ this.elements += ',header'; delete this.header; }else if(this.title && this.header !== false){ this.elements += ',header'; } if(this.footer === true){ this.elements += ',footer'; delete this.footer; } if(this.buttons){ var btns = this.buttons; this.buttons = []; for(var i = 0, len = btns.length; i < len; i++) { if(btns[i].render){ this.buttons.push(btns[i]); }else{ this.addButton(btns[i]); } } } if(this.autoLoad){ this.on('render', this.doAutoLoad, this, {delay:10}); } }, createElement : function(name, pnode){ if(this[name]){ pnode.appendChild(this[name].dom); return; } if(name === 'bwrap' || this.elements.indexOf(name) != -1){ if(this[name+'Cfg']){ this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']); }else{ var el = document.createElement('div'); el.className = this[name+'Cls']; this[name] = Ext.get(pnode.appendChild(el)); } } }, onRender : function(ct, position){ Ext.Panel.superclass.onRender.call(this, ct, position); this.createClasses(); if(this.el){ this.el.addClass(this.baseCls); this.header = this.el.down('.'+this.headerCls); this.bwrap = this.el.down('.'+this.bwrapCls); var cp = this.bwrap ? this.bwrap : this.el; this.tbar = cp.down('.'+this.tbarCls); this.body = cp.down('.'+this.bodyCls); this.bbar = cp.down('.'+this.bbarCls); this.footer = cp.down('.'+this.footerCls); this.fromMarkup = true; }else{ this.el = ct.createChild({ id: this.id, cls: this.baseCls }, position); } var el = this.el, d = el.dom; if(this.cls){ this.el.addClass(this.cls); } if(this.buttons){ this.elements += ',footer'; } if(this.frame){ el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls)); this.createElement('header', d.firstChild.firstChild.firstChild); this.createElement('bwrap', d); var bw = this.bwrap.dom; var ml = d.childNodes[1], bl = d.childNodes[2]; bw.appendChild(ml); bw.appendChild(bl); var mc = bw.firstChild.firstChild.firstChild; this.createElement('tbar', mc); this.createElement('body', mc); this.createElement('bbar', mc); this.createElement('footer', bw.lastChild.firstChild.firstChild); if(!this.footer){ this.bwrap.dom.lastChild.className += ' x-panel-nofooter'; } }else{ this.createElement('header', d); this.createElement('bwrap', d); var bw = this.bwrap.dom; this.createElement('tbar', bw); this.createElement('body', bw); this.createElement('bbar', bw); this.createElement('footer', bw); if(!this.header){ this.body.addClass(this.bodyCls + '-noheader'); if(this.tbar){ this.tbar.addClass(this.tbarCls + '-noheader'); } } } if(this.border === false){ this.el.addClass(this.baseCls + '-noborder'); this.body.addClass(this.bodyCls + '-noborder'); if(this.header){ this.header.addClass(this.headerCls + '-noborder'); } if(this.footer){ this.footer.addClass(this.footerCls + '-noborder'); } if(this.tbar){ this.tbar.addClass(this.tbarCls + '-noborder'); } if(this.bbar){ this.bbar.addClass(this.bbarCls + '-noborder'); } } if(this.bodyBorder === false){ this.body.addClass(this.bodyCls + '-noborder'); } if(this.bodyStyle){ this.body.applyStyles(this.bodyStyle); } this.bwrap.enableDisplayMode('block'); if(this.header){ this.header.unselectable(); if(this.headerAsText){ this.header.dom.innerHTML = '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>'; if(this.iconCls){ this.setIconClass(this.iconCls); } } } if(this.floating){ this.makeFloating(this.floating); } if(this.collapsible){ this.tools = this.tools ? this.tools.slice(0) : []; if(!this.hideCollapseTool){ this.tools[this.collapseFirst?'unshift':'push']({ id: 'toggle', handler : this.toggleCollapse, scope: this }); } if(this.titleCollapse && this.header){ this.header.on('click', this.toggleCollapse, this); this.header.setStyle('cursor', 'pointer'); } } if(this.tools){ var ts = this.tools; this.tools = {}; this.addTool.apply(this, ts); }else{ this.tools = {}; } if(this.buttons && this.buttons.length > 0){ var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: { cls:"x-panel-btns x-panel-btns-"+this.buttonAlign, html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>' }}, null, true); var tr = tb.getElementsByTagName('tr')[0]; for(var i = 0, len = this.buttons.length; i < len; i++) { var b = this.buttons[i]; var td = document.createElement('td'); td.className = 'x-panel-btn-td'; b.render(tr.appendChild(td)); } } if(this.tbar && this.topToolbar){ if(Ext.isArray(this.topToolbar)){ this.topToolbar = new Ext.Toolbar(this.topToolbar); } this.topToolbar.render(this.tbar); } if(this.bbar && this.bottomToolbar){ if(Ext.isArray(this.bottomToolbar)){ this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar); } this.bottomToolbar.render(this.bbar); } }, setIconClass : function(cls){ var old = this.iconCls; this.iconCls = cls; if(this.rendered && this.header){ if(this.frame){ this.header.addClass('x-panel-icon'); this.header.replaceClass(old, this.iconCls); }else{ var hd = this.header.dom; var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null; if(img){ Ext.fly(img).replaceClass(old, this.iconCls); }else{ Ext.DomHelper.insertBefore(hd.firstChild, { tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls }); } } } }, makeFloating : function(cfg){ this.floating = true; this.el = new Ext.Layer( typeof cfg == 'object' ? cfg : { shadow: this.shadow !== undefined ? this.shadow : 'sides', shadowOffset: this.shadowOffset, constrain:false, shim: this.shim === false ? false : undefined }, this.el ); }, getTopToolbar : function(){ return this.topToolbar; }, getBottomToolbar : function(){ return this.bottomToolbar; }, addButton : function(config, handler, scope){ var bc = { handler: handler, scope: scope, minWidth: this.minButtonWidth, hideParent:true }; if(typeof config == "string"){ bc.text = config; }else{ Ext.apply(bc, config); } var btn = new Ext.Button(bc); btn.ownerCt = this; if(!this.buttons){ this.buttons = []; } this.buttons.push(btn); return btn; }, addTool : function(){ if(!this[this.toolTarget]) { return; } if(!this.toolTemplate){ var tt = new Ext.Template( '<div class="x-tool x-tool-{id}">&#160;</div>' ); tt.disableFormats = true; tt.compile(); Ext.Panel.prototype.toolTemplate = tt; } for(var i = 0, a = arguments, len = a.length; i < len; i++) { var tc = a[i], overCls = 'x-tool-'+tc.id+'-over'; var t = this.toolTemplate.insertFirst(this[this.toolTarget], tc, true); this.tools[tc.id] = t; t.enableDisplayMode('block'); t.on('click', this.createToolHandler(t, tc, overCls, this)); if(tc.on){ t.on(tc.on); } if(tc.hidden){ t.hide(); } if(tc.qtip){ if(typeof tc.qtip == 'object'){ Ext.QuickTips.register(Ext.apply({ target: t.id }, tc.qtip)); } else { t.dom.qtip = tc.qtip; } } t.addClassOnOver(overCls); } }, onShow : function(){ if(this.floating){ return this.el.show(); } Ext.Panel.superclass.onShow.call(this); }, onHide : function(){ if(this.floating){ return this.el.hide(); } Ext.Panel.superclass.onHide.call(this); }, createToolHandler : function(t, tc, overCls, panel){ return function(e){ t.removeClass(overCls); e.stopEvent(); if(tc.handler){ tc.handler.call(tc.scope || t, e, t, panel); } }; }, afterRender : function(){ if(this.fromMarkup && this.height === undefined && !this.autoHeight){ this.height = this.el.getHeight(); } if(this.floating && !this.hidden && !this.initHidden){ this.el.show(); } if(this.title){ this.setTitle(this.title); } this.setAutoScroll(); if(this.html){ this.body.update(typeof this.html == 'object' ? Ext.DomHelper.markup(this.html) : this.html); delete this.html; } if(this.contentEl){ var ce = Ext.getDom(this.contentEl); Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']); this.body.dom.appendChild(ce); } if(this.collapsed){ this.collapsed = false; this.collapse(false); } Ext.Panel.superclass.afterRender.call(this); this.initEvents(); }, setAutoScroll : function(){ if(this.rendered && this.autoScroll){ this.body.setOverflow('auto'); } }, getKeyMap : function(){ if(!this.keyMap){ this.keyMap = new Ext.KeyMap(this.el, this.keys); } return this.keyMap; }, initEvents : function(){ if(this.keys){ this.getKeyMap(); } if(this.draggable){ this.initDraggable(); } }, initDraggable : function(){ this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable); }, beforeEffect : function(){ if(this.floating){ this.el.beforeAction(); } this.el.addClass('x-panel-animated'); }, afterEffect : function(){ this.syncShadow(); this.el.removeClass('x-panel-animated'); }, createEffect : function(a, cb, scope){ var o = { scope:scope, block:true }; if(a === true){ o.callback = cb; return o; }else if(!a.callback){ o.callback = cb; }else { o.callback = function(){ cb.call(scope); Ext.callback(a.callback, a.scope); }; } return Ext.applyIf(o, a); }, collapse : function(animate){ if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){ return; } var doAnim = animate === true || (animate !== false && this.animCollapse); this.beforeEffect(); this.onCollapse(doAnim, animate); return this; }, onCollapse : function(doAnim, animArg){ if(doAnim){ this[this.collapseEl].slideOut(this.slideAnchor, Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this), this.collapseDefaults)); }else{ this[this.collapseEl].hide(); this.afterCollapse(); } }, afterCollapse : function(){ this.collapsed = true; this.el.addClass(this.collapsedCls); this.afterEffect(); this.fireEvent('collapse', this); }, expand : function(animate){ if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){ return; } var doAnim = animate === true || (animate !== false && this.animCollapse); this.el.removeClass(this.collapsedCls); this.beforeEffect(); this.onExpand(doAnim, animate); return this; }, onExpand : function(doAnim, animArg){ if(doAnim){ this[this.collapseEl].slideIn(this.slideAnchor, Ext.apply(this.createEffect(animArg||true, this.afterExpand, this), this.expandDefaults)); }else{ this[this.collapseEl].show(); this.afterExpand(); } }, afterExpand : function(){ this.collapsed = false; this.afterEffect(); this.fireEvent('expand', this); }, toggleCollapse : function(animate){ this[this.collapsed ? 'expand' : 'collapse'](animate); return this; }, onDisable : function(){ if(this.rendered && this.maskDisabled){ this.el.mask(); } Ext.Panel.superclass.onDisable.call(this); }, onEnable : function(){ if(this.rendered && this.maskDisabled){ this.el.unmask(); } Ext.Panel.superclass.onEnable.call(this); }, onResize : function(w, h){ if(w !== undefined || h !== undefined){ if(!this.collapsed){ if(typeof w == 'number'){ this.body.setWidth( this.adjustBodyWidth(w - this.getFrameWidth())); }else if(w == 'auto'){ this.body.setWidth(w); } if(typeof h == 'number'){ this.body.setHeight( this.adjustBodyHeight(h - this.getFrameHeight())); }else if(h == 'auto'){ this.body.setHeight(h); } }else{ this.queuedBodySize = {width: w, height: h}; if(!this.queuedExpand && this.allowQueuedExpand !== false){ this.queuedExpand = true; this.on('expand', function(){ delete this.queuedExpand; this.onResize(this.queuedBodySize.width, this.queuedBodySize.height); this.doLayout(); }, this, {single:true}); } } this.fireEvent('bodyresize', this, w, h); } this.syncShadow(); }, adjustBodyHeight : function(h){ return h; }, adjustBodyWidth : function(w){ return w; }, onPosition : function(){ this.syncShadow(); }, onDestroy : function(){ if(this.tools){ for(var k in this.tools){ Ext.destroy(this.tools[k]); } } if(this.buttons){ for(var b in this.buttons){ Ext.destroy(this.buttons[b]); } } Ext.destroy( this.topToolbar, this.bottomToolbar ); Ext.Panel.superclass.onDestroy.call(this); }, getFrameWidth : function(){ var w = this.el.getFrameWidth('lr'); if(this.frame){ var l = this.bwrap.dom.firstChild; w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r')); var mc = this.bwrap.dom.firstChild.firstChild.firstChild; w += Ext.fly(mc).getFrameWidth('lr'); } return w; }, getFrameHeight : function(){ var h = this.el.getFrameWidth('tb'); h += (this.tbar ? this.tbar.getHeight() : 0) + (this.bbar ? this.bbar.getHeight() : 0); if(this.frame){ var hd = this.el.dom.firstChild; var ft = this.bwrap.dom.lastChild; h += (hd.offsetHeight + ft.offsetHeight); var mc = this.bwrap.dom.firstChild.firstChild.firstChild; h += Ext.fly(mc).getFrameWidth('tb'); }else{ h += (this.header ? this.header.getHeight() : 0) + (this.footer ? this.footer.getHeight() : 0); } return h; }, getInnerWidth : function(){ return this.getSize().width - this.getFrameWidth(); }, getInnerHeight : function(){ return this.getSize().height - this.getFrameHeight(); }, syncShadow : function(){ if(this.floating){ this.el.sync(true); } }, getLayoutTarget : function(){ return this.body; }, setTitle : function(title, iconCls){ this.title = title; if(this.header && this.headerAsText){ this.header.child('span').update(title); } if(iconCls){ this.setIconClass(iconCls); } this.fireEvent('titlechange', this, title); return this; }, getUpdater : function(){ return this.body.getUpdater(); }, load : function(){ var um = this.body.getUpdater(); um.update.apply(um, arguments); return this; }, beforeDestroy : function(){ Ext.Element.uncache( this.header, this.tbar, this.bbar, this.footer, this.body ); }, createClasses : function(){ this.headerCls = this.baseCls + '-header'; this.headerTextCls = this.baseCls + '-header-text'; this.bwrapCls = this.baseCls + '-bwrap'; this.tbarCls = this.baseCls + '-tbar'; this.bodyCls = this.baseCls + '-body'; this.bbarCls = this.baseCls + '-bbar'; this.footerCls = this.baseCls + '-footer'; }, createGhost : function(cls, useShim, appendTo){ var el = document.createElement('div'); el.className = 'x-panel-ghost ' + (cls ? cls : ''); if(this.header){ el.appendChild(this.el.dom.firstChild.cloneNode(true)); } Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight()); el.style.width = this.el.dom.offsetWidth + 'px';; if(!appendTo){ this.container.dom.appendChild(el); }else{ Ext.getDom(appendTo).appendChild(el); } if(useShim !== false && this.el.useShim !== false){ var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el); layer.show(); return layer; }else{ return new Ext.Element(el); } }, doAutoLoad : function(){ this.body.load( typeof this.autoLoad == 'object' ? this.autoLoad : {url: this.autoLoad}); } }); Ext.reg('panel', Ext.Panel); Ext.Window = Ext.extend(Ext.Panel, { baseCls : 'x-window', resizable:true, draggable:true, closable : true, constrain:false, constrainHeader:false, plain:false, minimizable : false, maximizable : false, minHeight: 100, minWidth: 200, expandOnShow: true, closeAction: 'close', collapsible:false, initHidden : true, monitorResize : true, elements: 'header,body', frame:true, floating:true, initComponent : function(){ Ext.Window.superclass.initComponent.call(this); this.addEvents( 'resize', 'maximize', 'minimize', 'restore' ); }, getState : function(){ return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox()); }, onRender : function(ct, position){ Ext.Window.superclass.onRender.call(this, ct, position); if(this.plain){ this.el.addClass('x-window-plain'); } this.focusEl = this.el.createChild({ tag: "a", href:"#", cls:"x-dlg-focus", tabIndex:"-1", html: "&#160;"}); this.focusEl.swallowEvent('click', true); this.proxy = this.el.createProxy("x-window-proxy"); this.proxy.enableDisplayMode('block'); if(this.modal){ this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom); this.mask.enableDisplayMode("block"); this.mask.hide(); } }, initEvents : function(){ Ext.Window.superclass.initEvents.call(this); if(this.animateTarget){ this.setAnimateTarget(this.animateTarget); } if(this.resizable){ this.resizer = new Ext.Resizable(this.el, { minWidth: this.minWidth, minHeight:this.minHeight, handles: this.resizeHandles || "all", pinned: true, resizeElement : this.resizerAction }); this.resizer.window = this; this.resizer.on("beforeresize", this.beforeResize, this); } if(this.draggable){ this.header.addClass("x-window-draggable"); } this.initTools(); this.el.on("mousedown", this.toFront, this); this.manager = this.manager || Ext.WindowMgr; this.manager.register(this); this.hidden = true; if(this.maximized){ this.maximized = false; this.maximize(); } if(this.closable){ var km = this.getKeyMap(); km.on(27, this.onEsc, this); km.disable(); } }, initDraggable : function(){ this.dd = new Ext.Window.DD(this); }, onEsc : function(){ this[this.closeAction](); }, beforeDestroy : function(){ Ext.destroy( this.resizer, this.dd, this.proxy, this.mask ); Ext.Window.superclass.beforeDestroy.call(this); }, onDestroy : function(){ if(this.manager){ this.manager.unregister(this); } Ext.Window.superclass.onDestroy.call(this); }, initTools : function(){ if(this.minimizable){ this.addTool({ id: 'minimize', handler: this.minimize.createDelegate(this, []) }); } if(this.maximizable){ this.addTool({ id: 'maximize', handler: this.maximize.createDelegate(this, []) }); this.addTool({ id: 'restore', handler: this.restore.createDelegate(this, []), hidden:true }); this.header.on('dblclick', this.toggleMaximize, this); } if(this.closable){ this.addTool({ id: 'close', handler: this[this.closeAction].createDelegate(this, []) }); } }, resizerAction : function(){ var box = this.proxy.getBox(); this.proxy.hide(); this.window.handleResize(box); return box; }, beforeResize : function(){ this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40); this.resizeBox = this.el.getBox(); }, updateHandles : function(){ if(Ext.isIE && this.resizer){ this.resizer.syncHandleHeight(); this.el.repaint(); } }, handleResize : function(box){ var rz = this.resizeBox; if(rz.x != box.x || rz.y != box.y){ this.updateBox(box); }else{ this.setSize(box); } this.focus(); this.updateHandles(); this.saveState(); this.fireEvent("resize", this, box.width, box.height); }, focus : function(){ var f = this.focusEl, db = this.defaultButton, t = typeof db; if(t != 'undefined'){ if(t == 'number'){ f = this.buttons[db]; }else if(t == 'string'){ f = Ext.getCmp(db); }else{ f = db; } } f.focus.defer(10, f); }, setAnimateTarget : function(el){ el = Ext.get(el); this.animateTarget = el; }, beforeShow : function(){ delete this.el.lastXY; delete this.el.lastLT; if(this.x === undefined || this.y === undefined){ var xy = this.el.getAlignToXY(this.container, 'c-c'); var pos = this.el.translatePoints(xy[0], xy[1]); this.x = this.x === undefined? pos.left : this.x; this.y = this.y === undefined? pos.top : this.y; } this.el.setLeftTop(this.x, this.y); if(this.expandOnShow){ this.expand(false); } if(this.modal){ Ext.getBody().addClass("x-body-masked"); this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true)); this.mask.show(); } }, show : function(animateTarget, cb, scope){ if(!this.rendered){ this.render(Ext.getBody()); } if(this.hidden === false){ this.toFront(); return; } if(this.fireEvent("beforeshow", this) === false){ return; } if(cb){ this.on('show', cb, scope, {single:true}); } this.hidden = false; if(animateTarget !== undefined){ this.setAnimateTarget(animateTarget); } this.beforeShow(); if(this.animateTarget){ this.animShow(); }else{ this.afterShow(); } }, afterShow : function(){ this.proxy.hide(); this.el.setStyle('display', 'block'); this.el.show(); if(this.maximized){ this.fitContainer(); } if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll); } if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){ Ext.EventManager.onWindowResize(this.onWindowResize, this); } this.doConstrain(); if(this.layout){ this.doLayout(); } if(this.keyMap){ this.keyMap.enable(); } this.toFront(); this.updateHandles(); this.fireEvent("show", this); }, animShow : function(){ this.proxy.show(); this.proxy.setBox(this.animateTarget.getBox()); this.proxy.setOpacity(0); var b = this.getBox(false); b.callback = this.afterShow; b.scope = this; b.duration = .25; b.easing = 'easeNone'; b.opacity = .5; b.block = true; this.el.setStyle('display', 'none'); this.proxy.shift(b); }, hide : function(animateTarget, cb, scope){ if(this.hidden || this.fireEvent("beforehide", this) === false){ return; } if(cb){ this.on('hide', cb, scope, {single:true}); } this.hidden = true; if(animateTarget !== undefined){ this.setAnimateTarget(animateTarget); } if(this.animateTarget){ this.animHide(); }else{ this.el.hide(); this.afterHide(); } }, afterHide : function(){ this.proxy.hide(); if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){ Ext.EventManager.removeResizeListener(this.onWindowResize, this); } if(this.modal){ this.mask.hide(); Ext.getBody().removeClass("x-body-masked"); } if(this.keyMap){ this.keyMap.disable(); } this.fireEvent("hide", this); }, animHide : function(){ this.proxy.setOpacity(.5); this.proxy.show(); var tb = this.getBox(false); this.proxy.setBox(tb); this.el.hide(); var b = this.animateTarget.getBox(); b.callback = this.afterHide; b.scope = this; b.duration = .25; b.easing = 'easeNone'; b.block = true; b.opacity = 0; this.proxy.shift(b); }, onWindowResize : function(){ if(this.maximized){ this.fitContainer(); } if(this.modal){ this.mask.setSize('100%', '100%'); var force = this.mask.dom.offsetHeight; this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true)); } this.doConstrain(); }, doConstrain : function(){ if(this.constrain || this.constrainHeader){ var offsets; if(this.constrain){ offsets = { right:this.el.shadowOffset, left:this.el.shadowOffset, bottom:this.el.shadowOffset }; }else { var s = this.getSize(); offsets = { right:-(s.width - 100), bottom:-(s.height - 25) }; } var xy = this.el.getConstrainToXY(this.container, true, offsets); if(xy){ this.setPosition(xy[0], xy[1]); } } }, ghost : function(cls){ var ghost = this.createGhost(cls); var box = this.getBox(true); ghost.setLeftTop(box.x, box.y); ghost.setWidth(box.width); this.el.hide(); this.activeGhost = ghost; return ghost; }, unghost : function(show, matchPosition){ if(show !== false){ this.el.show(); this.focus(); if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll); } } if(matchPosition !== false){ this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true)); } this.activeGhost.hide(); this.activeGhost.remove(); delete this.activeGhost; }, minimize : function(){ this.fireEvent('minimize', this); }, close : function(){ if(this.fireEvent("beforeclose", this) !== false){ this.hide(null, function(){ this.fireEvent('close', this); this.destroy(); }, this); } }, maximize : function(){ if(!this.maximized){ this.expand(false); this.restoreSize = this.getSize(); this.restorePos = this.getPosition(true); this.tools.maximize.hide(); this.tools.restore.show(); this.maximized = true; this.el.disableShadow(); if(this.dd){ this.dd.lock(); } if(this.collapsible){ this.tools.toggle.hide(); } this.el.addClass('x-window-maximized'); this.container.addClass('x-window-maximized-ct'); this.setPosition(0, 0); this.fitContainer(); this.fireEvent('maximize', this); } }, restore : function(){ if(this.maximized){ this.el.removeClass('x-window-maximized'); this.tools.restore.hide(); this.tools.maximize.show(); this.setPosition(this.restorePos[0], this.restorePos[1]); this.setSize(this.restoreSize.width, this.restoreSize.height); delete this.restorePos; delete this.restoreSize; this.maximized = false; this.el.enableShadow(true); if(this.dd){ this.dd.unlock(); } if(this.collapsible){ this.tools.toggle.show(); } this.container.removeClass('x-window-maximized-ct'); this.doConstrain(); this.fireEvent('restore', this); } }, toggleMaximize : function(){ this[this.maximized ? 'restore' : 'maximize'](); }, fitContainer : function(){ var vs = this.container.getViewSize(); this.setSize(vs.width, vs.height); }, setZIndex : function(index){ if(this.modal){ this.mask.setStyle("z-index", index); } this.el.setZIndex(++index); index += 5; if(this.resizer){ this.resizer.proxy.setStyle("z-index", ++index); } this.lastZIndex = index; }, alignTo : function(element, position, offsets){ var xy = this.el.getAlignToXY(element, position, offsets); this.setPagePosition(xy[0], xy[1]); return this; }, anchorTo : function(el, alignment, offsets, monitorScroll, _pname){ var action = function(){ this.alignTo(el, alignment, offsets); }; Ext.EventManager.onWindowResize(action, this); var tm = typeof monitorScroll; if(tm != 'undefined'){ Ext.EventManager.on(window, 'scroll', action, this, {buffer: tm == 'number' ? monitorScroll : 50}); } action.call(this); this[_pname] = action; return this; }, toFront : function(){ if(this.manager.bringToFront(this)){ this.focus(); } return this; }, setActive : function(active){ if(active){ if(!this.maximized){ this.el.enableShadow(true); } this.fireEvent('activate', this); }else{ this.el.disableShadow(); this.fireEvent('deactivate', this); } }, toBack : function(){ this.manager.sendToBack(this); return this; }, center : function(){ var xy = this.el.getAlignToXY(this.container, 'c-c'); this.setPagePosition(xy[0], xy[1]); return this; } }); Ext.reg('window', Ext.Window); Ext.Window.DD = function(win){ this.win = win; Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id); this.setHandleElId(win.header.id); this.scroll = false; }; Ext.extend(Ext.Window.DD, Ext.dd.DD, { moveOnly:true, headerOffsets:[100, 25], startDrag : function(){ var w = this.win; this.proxy = w.ghost(); if(w.constrain !== false){ var so = w.el.shadowOffset; this.constrainTo(w.container, {right: so, left: so, bottom: so}); }else if(w.constrainHeader !== false){ var s = this.proxy.getSize(); this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])}); } }, b4Drag : Ext.emptyFn, onDrag : function(e){ this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY()); }, endDrag : function(e){ this.win.unghost(); this.win.saveState(); } }); Ext.WindowGroup = function(){ var list = {}; var accessList = []; var front = null; var sortWindows = function(d1, d2){ return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1; }; var orderWindows = function(){ var a = accessList, len = a.length; if(len > 0){ a.sort(sortWindows); var seed = a[0].manager.zseed; for(var i = 0; i < len; i++){ var win = a[i]; if(win && !win.hidden){ win.setZIndex(seed + (i*10)); } } } activateLast(); }; var setActiveWin = function(win){ if(win != front){ if(front){ front.setActive(false); } front = win; if(win){ win.setActive(true); } } }; var activateLast = function(){ for(var i = accessList.length-1; i >=0; --i) { if(!accessList[i].hidden){ setActiveWin(accessList[i]); return; } } setActiveWin(null); }; return { zseed : 9000, register : function(win){ list[win.id] = win; accessList.push(win); win.on('hide', activateLast); }, unregister : function(win){ delete list[win.id]; win.un('hide', activateLast); accessList.remove(win); }, get : function(id){ return typeof id == "object" ? id : list[id]; }, bringToFront : function(win){ win = this.get(win); if(win != front){ win._lastAccess = new Date().getTime(); orderWindows(); return true; } return false; }, sendToBack : function(win){ win = this.get(win); win._lastAccess = -(new Date().getTime()); orderWindows(); return win; }, hideAll : function(){ for(var id in list){ if(list[id] && typeof list[id] != "function" && list[id].isVisible()){ list[id].hide(); } } }, getActive : function(){ return front; }, getBy : function(fn, scope){ var r = []; for(var i = accessList.length-1; i >=0; --i) { var win = accessList[i]; if(fn.call(scope||win, win) !== false){ r.push(win); } } return r; }, each : function(fn, scope){ for(var id in list){ if(list[id] && typeof list[id] != "function"){ if(fn.call(scope || list[id], list[id]) === false){ return; } } } } }; }; Ext.WindowMgr = new Ext.WindowGroup(); Ext.dd.PanelProxy = function(panel, config){ this.panel = panel; this.id = this.panel.id +'-ddproxy'; Ext.apply(this, config); }; Ext.dd.PanelProxy.prototype = { insertProxy : true, setStatus : Ext.emptyFn, reset : Ext.emptyFn, update : Ext.emptyFn, stop : Ext.emptyFn, sync: Ext.emptyFn, getEl : function(){ return this.ghost; }, getGhost : function(){ return this.ghost; }, getProxy : function(){ return this.proxy; }, hide : function(){ if(this.ghost){ if(this.proxy){ this.proxy.remove(); delete this.proxy; } this.panel.el.dom.style.display = ''; this.ghost.remove(); delete this.ghost; } }, show : function(){ if(!this.ghost){ this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody()); this.ghost.setXY(this.panel.el.getXY()) if(this.insertProxy){ this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'}); this.proxy.setSize(this.panel.getSize()); } this.panel.el.dom.style.display = 'none'; } }, repair : function(xy, callback, scope){ this.hide(); if(typeof callback == "function"){ callback.call(scope || this); } }, moveProxy : function(parentNode, before){ if(this.proxy){ parentNode.insertBefore(this.proxy.dom, before); } } }; Ext.Panel.DD = function(panel, cfg){ this.panel = panel; this.dragData = {panel: panel}; this.proxy = new Ext.dd.PanelProxy(panel, cfg); Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg); this.setHandleElId(panel.header.id); panel.header.setStyle('cursor', 'move'); this.scroll = false; }; Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, { showFrame: Ext.emptyFn, startDrag: Ext.emptyFn, b4StartDrag: function(x, y) { this.proxy.show(); }, b4MouseDown: function(e) { var x = e.getPageX(); var y = e.getPageY(); this.autoOffset(x, y); }, onInitDrag : function(x, y){ this.onStartDrag(x, y); return true; }, createFrame : Ext.emptyFn, getDragEl : function(e){ return this.proxy.ghost.dom; }, endDrag : function(e){ this.proxy.hide(); this.panel.saveState(); }, autoOffset : function(x, y) { x -= this.startPageX; y -= this.startPageY; this.setDelta(x, y); } }); Ext.state.Provider = function(){ this.addEvents("statechange"); this.state = {}; Ext.state.Provider.superclass.constructor.call(this); }; Ext.extend(Ext.state.Provider, Ext.util.Observable, { get : function(name, defaultValue){ return typeof this.state[name] == "undefined" ? defaultValue : this.state[name]; }, clear : function(name){ delete this.state[name]; this.fireEvent("statechange", this, name, null); }, set : function(name, value){ this.state[name] = value; this.fireEvent("statechange", this, name, value); }, decodeValue : function(cookie){ var re = /^(a|n|d|b|s|o)\:(.*)$/; var matches = re.exec(unescape(cookie)); if(!matches || !matches[1]) return; var type = matches[1]; var v = matches[2]; switch(type){ case "n": return parseFloat(v); case "d": return new Date(Date.parse(v)); case "b": return (v == "1"); case "a": var all = []; var values = v.split("^"); for(var i = 0, len = values.length; i < len; i++){ all.push(this.decodeValue(values[i])); } return all; case "o": var all = {}; var values = v.split("^"); for(var i = 0, len = values.length; i < len; i++){ var kv = values[i].split("="); all[kv[0]] = this.decodeValue(kv[1]); } return all; default: return v; } }, encodeValue : function(v){ var enc; if(typeof v == "number"){ enc = "n:" + v; }else if(typeof v == "boolean"){ enc = "b:" + (v ? "1" : "0"); }else if(Ext.isDate(v)){ enc = "d:" + v.toGMTString(); }else if(Ext.isArray(v)){ var flat = ""; for(var i = 0, len = v.length; i < len; i++){ flat += this.encodeValue(v[i]); if(i != len-1) flat += "^"; } enc = "a:" + flat; }else if(typeof v == "object"){ var flat = ""; for(var key in v){ if(typeof v[key] != "function" && v[key] !== undefined){ flat += key + "=" + this.encodeValue(v[key]) + "^"; } } enc = "o:" + flat.substring(0, flat.length-1); }else{ enc = "s:" + v; } return escape(enc); } }); Ext.state.Manager = function(){ var provider = new Ext.state.Provider(); return { setProvider : function(stateProvider){ provider = stateProvider; }, get : function(key, defaultValue){ return provider.get(key, defaultValue); }, set : function(key, value){ provider.set(key, value); }, clear : function(key){ provider.clear(key); }, getProvider : function(){ return provider; } }; }(); Ext.state.CookieProvider = function(config){ Ext.state.CookieProvider.superclass.constructor.call(this); this.path = "/"; this.expires = new Date(new Date().getTime()+(1000*60*60*24*7)); this.domain = null; this.secure = false; Ext.apply(this, config); this.state = this.readCookies(); }; Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, { set : function(name, value){ if(typeof value == "undefined" || value === null){ this.clear(name); return; } this.setCookie(name, value); Ext.state.CookieProvider.superclass.set.call(this, name, value); }, clear : function(name){ this.clearCookie(name); Ext.state.CookieProvider.superclass.clear.call(this, name); }, readCookies : function(){ var cookies = {}; var c = document.cookie + ";"; var re = /\s?(.*?)=(.*?);/g; var matches; while((matches = re.exec(c)) != null){ var name = matches[1]; var value = matches[2]; if(name && name.substring(0,3) == "ys-"){ cookies[name.substr(3)] = this.decodeValue(value); } } return cookies; }, setCookie : function(name, value){ document.cookie = "ys-"+ name + "=" + this.encodeValue(value) + ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) + ((this.path == null) ? "" : ("; path=" + this.path)) + ((this.domain == null) ? "" : ("; domain=" + this.domain)) + ((this.secure == true) ? "; secure" : ""); }, clearCookie : function(name){ document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" + ((this.path == null) ? "" : ("; path=" + this.path)) + ((this.domain == null) ? "" : ("; domain=" + this.domain)) + ((this.secure == true) ? "; secure" : ""); } }); Ext.DataView = Ext.extend(Ext.BoxComponent, { selectedClass : "x-view-selected", emptyText : "", last: false, initComponent : function(){ Ext.DataView.superclass.initComponent.call(this); if(typeof this.tpl == "string"){ this.tpl = new Ext.XTemplate(this.tpl); } this.addEvents( "beforeclick", "click", "containerclick", "dblclick", "contextmenu", "selectionchange", "beforeselect" ); this.all = new Ext.CompositeElementLite(); this.selected = new Ext.CompositeElementLite(); }, onRender : function(){ if(!this.el){ this.el = document.createElement('div'); } Ext.DataView.superclass.onRender.apply(this, arguments); }, afterRender : function(){ Ext.DataView.superclass.afterRender.call(this); this.el.on({ "click": this.onClick, "dblclick": this.onDblClick, "contextmenu": this.onContextMenu, scope:this }); if(this.overClass){ this.el.on({ "mouseover": this.onMouseOver, "mouseout": this.onMouseOut, scope:this }); } if(this.store){ this.setStore(this.store, true); } }, refresh : function(){ this.clearSelections(false, true); this.el.update(""); var html = []; var records = this.store.getRange(); if(records.length < 1){ this.el.update(this.emptyText); this.all.clear(); return; } this.tpl.overwrite(this.el, this.collectData(records, 0)); this.all.fill(Ext.query(this.itemSelector, this.el.dom)); this.updateIndexes(0); }, prepareData : function(data){ return data; }, collectData : function(records, startIndex){ var r = []; for(var i = 0, len = records.length; i < len; i++){ r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]); } return r; }, bufferRender : function(records){ var div = document.createElement('div'); this.tpl.overwrite(div, this.collectData(records)); return Ext.query(this.itemSelector, div); }, onUpdate : function(ds, record){ var index = this.store.indexOf(record); var sel = this.isSelected(index); var original = this.all.elements[index]; var node = this.bufferRender([record], index)[0]; this.all.replaceElement(index, node, true); if(sel){ this.selected.replaceElement(original, node); this.all.item(index).addClass(this.selectedClass); } this.updateIndexes(index, index); }, onAdd : function(ds, records, index){ if(this.all.getCount() == 0){ this.refresh(); return; } var nodes = this.bufferRender(records, index), n; if(index < this.all.getCount()){ n = this.all.item(index).insertSibling(nodes, 'before', true); this.all.elements.splice(index, 0, n); }else{ n = this.all.last().insertSibling(nodes, 'after', true); this.all.elements.push(n); } this.updateIndexes(index); }, onRemove : function(ds, record, index){ this.deselect(index); this.all.removeElement(index, true); this.updateIndexes(index); }, refreshNode : function(index){ this.onUpdate(this.store, this.store.getAt(index)); }, updateIndexes : function(startIndex, endIndex){ var ns = this.all.elements; startIndex = startIndex || 0; endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1)); for(var i = startIndex; i <= endIndex; i++){ ns[i].viewIndex = i; } }, setStore : function(store, initial){ if(!initial && this.store){ this.store.un("beforeload", this.onBeforeLoad, this); this.store.un("datachanged", this.refresh, this); this.store.un("add", this.onAdd, this); this.store.un("remove", this.onRemove, this); this.store.un("update", this.onUpdate, this); this.store.un("clear", this.refresh, this); } if(store){ store = Ext.StoreMgr.lookup(store); store.on("beforeload", this.onBeforeLoad, this); store.on("datachanged", this.refresh, this); store.on("add", this.onAdd, this); store.on("remove", this.onRemove, this); store.on("update", this.onUpdate, this); store.on("clear", this.refresh, this); } this.store = store; if(store){ this.refresh(); } }, findItemFromChild : function(node){ return Ext.fly(node).findParent(this.itemSelector, this.el); }, onClick : function(e){ var item = e.getTarget(this.itemSelector, this.el); if(item){ var index = this.indexOf(item); if(this.onItemClick(item, index, e) !== false){ this.fireEvent("click", this, index, item, e); } }else{ if(this.fireEvent("containerclick", this, e) !== false){ this.clearSelections(); } } }, onContextMenu : function(e){ var item = e.getTarget(this.itemSelector, this.el); if(item){ this.fireEvent("contextmenu", this, this.indexOf(item), item, e); } }, onDblClick : function(e){ var item = e.getTarget(this.itemSelector, this.el); if(item){ this.fireEvent("dblclick", this, this.indexOf(item), item, e); } }, onMouseOver : function(e){ var item = e.getTarget(this.itemSelector, this.el); if(item && item !== this.lastItem){ this.lastItem = item; Ext.fly(item).addClass(this.overClass); } }, onMouseOut : function(e){ if(this.lastItem){ if(!e.within(this.lastItem, true)){ Ext.fly(this.lastItem).removeClass(this.overClass); delete this.lastItem; } } }, onItemClick : function(item, index, e){ if(this.fireEvent("beforeclick", this, index, item, e) === false){ return false; } if(this.multiSelect){ this.doMultiSelection(item, index, e); e.preventDefault(); }else if(this.singleSelect){ this.doSingleSelection(item, index, e); e.preventDefault(); } return true; }, doSingleSelection : function(item, index, e){ if(e.ctrlKey && this.isSelected(index)){ this.deselect(index); }else{ this.select(index, false); } }, doMultiSelection : function(item, index, e){ if(e.shiftKey && this.last !== false){ var last = this.last; this.selectRange(last, index, e.ctrlKey); this.last = last; }else{ if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){ this.deselect(index); }else{ this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect); } } }, getSelectionCount : function(){ return this.selected.getCount() }, getSelectedNodes : function(){ return this.selected.elements; }, getSelectedIndexes : function(){ var indexes = [], s = this.selected.elements; for(var i = 0, len = s.length; i < len; i++){ indexes.push(s[i].viewIndex); } return indexes; }, getSelectedRecords : function(){ var r = [], s = this.selected.elements; for(var i = 0, len = s.length; i < len; i++){ r[r.length] = this.store.getAt(s[i].viewIndex); } return r; }, getRecords : function(nodes){ var r = [], s = nodes; for(var i = 0, len = s.length; i < len; i++){ r[r.length] = this.store.getAt(s[i].viewIndex); } return r; }, getRecord : function(node){ return this.store.getAt(node.viewIndex); }, clearSelections : function(suppressEvent, skipUpdate){ if(this.multiSelect || this.singleSelect){ if(!skipUpdate){ this.selected.removeClass(this.selectedClass); } this.selected.clear(); this.last = false; if(!suppressEvent){ this.fireEvent("selectionchange", this, this.selected.elements); } } }, isSelected : function(node){ return this.selected.contains(this.getNode(node)); }, deselect : function(node){ if(this.isSelected(node)){ var node = this.getNode(node); this.selected.removeElement(node); if(this.last == node.viewIndex){ this.last = false; } Ext.fly(node).removeClass(this.selectedClass); this.fireEvent("selectionchange", this, this.selected.elements); } }, select : function(nodeInfo, keepExisting, suppressEvent){ if(Ext.isArray(nodeInfo)){ if(!keepExisting){ this.clearSelections(true); } for(var i = 0, len = nodeInfo.length; i < len; i++){ this.select(nodeInfo[i], true, true); } } else{ var node = this.getNode(nodeInfo); if(!keepExisting){ this.clearSelections(true); } if(node && !this.isSelected(node)){ if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){ Ext.fly(node).addClass(this.selectedClass); this.selected.add(node); this.last = node.viewIndex; if(!suppressEvent){ this.fireEvent("selectionchange", this, this.selected.elements); } } } } }, selectRange : function(start, end, keepExisting){ if(!keepExisting){ this.clearSelections(true); } this.select(this.getNodes(start, end), true); }, getNode : function(nodeInfo){ if(typeof nodeInfo == "string"){ return document.getElementById(nodeInfo); }else if(typeof nodeInfo == "number"){ return this.all.elements[nodeInfo]; } return nodeInfo; }, getNodes : function(start, end){ var ns = this.all.elements; start = start || 0; end = typeof end == "undefined" ? ns.length - 1 : end; var nodes = [], i; if(start <= end){ for(i = start; i <= end; i++){ nodes.push(ns[i]); } } else{ for(i = start; i >= end; i--){ nodes.push(ns[i]); } } return nodes; }, indexOf : function(node){ node = this.getNode(node); if(typeof node.viewIndex == "number"){ return node.viewIndex; } return this.all.indexOf(node); }, onBeforeLoad : function(){ if(this.loadingText){ this.clearSelections(false, true); this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>'); this.all.clear(); } } }); Ext.reg('dataview', Ext.DataView); Ext.ColorPalette = function(config){ Ext.ColorPalette.superclass.constructor.call(this, config); this.addEvents( 'select' ); if(this.handler){ this.on("select", this.handler, this.scope, true); } }; Ext.extend(Ext.ColorPalette, Ext.Component, { itemCls : "x-color-palette", value : null, clickEvent:'click', ctype: "Ext.ColorPalette", allowReselect : false, colors : [ "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333", "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080", "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696", "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0", "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF" ], onRender : function(container, position){ var t = this.tpl || new Ext.XTemplate( '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>' ); var el = document.createElement("div"); el.className = this.itemCls; t.overwrite(el, this.colors); container.dom.insertBefore(el, position); this.el = Ext.get(el); this.el.on(this.clickEvent, this.handleClick, this, {delegate: "a"}); if(this.clickEvent != 'click'){ this.el.on('click', Ext.emptyFn, this, {delegate: "a", preventDefault:true}); } }, afterRender : function(){ Ext.ColorPalette.superclass.afterRender.call(this); if(this.value){ var s = this.value; this.value = null; this.select(s); } }, handleClick : function(e, t){ e.preventDefault(); if(!this.disabled){ var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1]; this.select(c.toUpperCase()); } }, select : function(color){ color = color.replace("#", ""); if(color != this.value || this.allowReselect){ var el = this.el; if(this.value){ el.child("a.color-"+this.value).removeClass("x-color-palette-sel"); } el.child("a.color-"+color).addClass("x-color-palette-sel"); this.value = color; this.fireEvent("select", this, color); } } }); Ext.reg('colorpalette', Ext.ColorPalette); Ext.DatePicker = Ext.extend(Ext.Component, { todayText : "Today", okText : "&#160;OK&#160;", cancelText : "Cancel", todayTip : "{0} (Spacebar)", minDate : null, maxDate : null, minText : "This date is before the minimum date", maxText : "This date is after the maximum date", format : "m/d/y", disabledDays : null, disabledDaysText : "", disabledDatesRE : null, disabledDatesText : "", constrainToViewport : true, monthNames : Date.monthNames, dayNames : Date.dayNames, nextText: 'Next Month (Control+Right)', prevText: 'Previous Month (Control+Left)', monthYearText: 'Choose a month (Control+Up/Down to move years)', startDay : 0, initComponent : function(){ Ext.DatePicker.superclass.initComponent.call(this); this.value = this.value ? this.value.clearTime() : new Date().clearTime(); this.addEvents( 'select' ); if(this.handler){ this.on("select", this.handler, this.scope || this); } this.initDisabledDays(); }, initDisabledDays : function(){ if(!this.disabledDatesRE && this.disabledDates){ var dd = this.disabledDates; var re = "(?:"; for(var i = 0; i < dd.length; i++){ re += dd[i]; if(i != dd.length-1) re += "|"; } this.disabledDatesRE = new RegExp(re + ")"); } }, setValue : function(value){ var old = this.value; this.value = value.clearTime(true); if(this.el){ this.update(this.value); } }, getValue : function(){ return this.value; }, focus : function(){ if(this.el){ this.update(this.activeDate); } }, onRender : function(container, position){ var m = [ '<table cellspacing="0">', '<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'">&#160;</a></td></tr>', '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>']; var dn = this.dayNames; for(var i = 0; i < 7; i++){ var d = this.startDay+i; if(d > 6){ d = d-7; } m.push("<th><span>", dn[d].substr(0,1), "</span></th>"); } m[m.length] = "</tr></thead><tbody><tr>"; for(var i = 0; i < 42; i++) { if(i % 7 == 0 && i != 0){ m[m.length] = "</tr><tr>"; } m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>'; } m[m.length] = '</tr></tbody></table></td></tr><tr><td colspan="3" class="x-date-bottom" align="center"></td></tr></table><div class="x-date-mp"></div>'; var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML = m.join(""); container.dom.insertBefore(el, position); this.el = Ext.get(el); this.eventEl = Ext.get(el.firstChild); new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), { handler: this.showPrevMonth, scope: this, preventDefault:true, stopDefault:true }); new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), { handler: this.showNextMonth, scope: this, preventDefault:true, stopDefault:true }); this.eventEl.on("mousewheel", this.handleMouseWheel, this); this.monthPicker = this.el.down('div.x-date-mp'); this.monthPicker.enableDisplayMode('block'); var kn = new Ext.KeyNav(this.eventEl, { "left" : function(e){ e.ctrlKey ? this.showPrevMonth() : this.update(this.activeDate.add("d", -1)); }, "right" : function(e){ e.ctrlKey ? this.showNextMonth() : this.update(this.activeDate.add("d", 1)); }, "up" : function(e){ e.ctrlKey ? this.showNextYear() : this.update(this.activeDate.add("d", -7)); }, "down" : function(e){ e.ctrlKey ? this.showPrevYear() : this.update(this.activeDate.add("d", 7)); }, "pageUp" : function(e){ this.showNextMonth(); }, "pageDown" : function(e){ this.showPrevMonth(); }, "enter" : function(e){ e.stopPropagation(); return true; }, scope : this }); this.eventEl.on("click", this.handleDateClick, this, {delegate: "a.x-date-date"}); this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday, this); this.el.unselectable(); this.cells = this.el.select("table.x-date-inner tbody td"); this.textNodes = this.el.query("table.x-date-inner tbody span"); this.mbtn = new Ext.Button({ text: "&#160;", tooltip: this.monthYearText, renderTo: this.el.child("td.x-date-middle", true) }); this.mbtn.on('click', this.showMonthPicker, this); this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu"); var today = (new Date()).dateFormat(this.format); this.todayBtn = new Ext.Button({ renderTo: this.el.child("td.x-date-bottom", true), text: String.format(this.todayText, today), tooltip: String.format(this.todayTip, today), handler: this.selectToday, scope: this }); if(Ext.isIE){ this.el.repaint(); } this.update(this.value); }, createMonthPicker : function(){ if(!this.monthPicker.dom.firstChild){ var buf = ['<table border="0" cellspacing="0">']; for(var i = 0; i < 6; i++){ buf.push( '<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>', '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>', i == 0 ? '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' : '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>' ); } buf.push( '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">', this.okText, '</button><button type="button" class="x-date-mp-cancel">', this.cancelText, '</button></td></tr>', '</table>' ); this.monthPicker.update(buf.join('')); this.monthPicker.on('click', this.onMonthClick, this); this.monthPicker.on('dblclick', this.onMonthDblClick, this); this.mpMonths = this.monthPicker.select('td.x-date-mp-month'); this.mpYears = this.monthPicker.select('td.x-date-mp-year'); this.mpMonths.each(function(m, a, i){ i += 1; if((i%2) == 0){ m.dom.xmonth = 5 + Math.round(i * .5); }else{ m.dom.xmonth = Math.round((i-1) * .5); } }); } }, showMonthPicker : function(){ this.createMonthPicker(); var size = this.el.getSize(); this.monthPicker.setSize(size); this.monthPicker.child('table').setSize(size); this.mpSelMonth = (this.activeDate || this.value).getMonth(); this.updateMPMonth(this.mpSelMonth); this.mpSelYear = (this.activeDate || this.value).getFullYear(); this.updateMPYear(this.mpSelYear); this.monthPicker.slideIn('t', {duration:.2}); }, updateMPYear : function(y){ this.mpyear = y; var ys = this.mpYears.elements; for(var i = 1; i <= 10; i++){ var td = ys[i-1], y2; if((i%2) == 0){ y2 = y + Math.round(i * .5); td.firstChild.innerHTML = y2; td.xyear = y2; }else{ y2 = y - (5-Math.round(i * .5)); td.firstChild.innerHTML = y2; td.xyear = y2; } this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel'); } }, updateMPMonth : function(sm){ this.mpMonths.each(function(m, a, i){ m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel'); }); }, selectMPMonth: function(m){ }, onMonthClick : function(e, t){ e.stopEvent(); var el = new Ext.Element(t), pn; if(el.is('button.x-date-mp-cancel')){ this.hideMonthPicker(); } else if(el.is('button.x-date-mp-ok')){ this.update(new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate())); this.hideMonthPicker(); } else if(pn = el.up('td.x-date-mp-month', 2)){ this.mpMonths.removeClass('x-date-mp-sel'); pn.addClass('x-date-mp-sel'); this.mpSelMonth = pn.dom.xmonth; } else if(pn = el.up('td.x-date-mp-year', 2)){ this.mpYears.removeClass('x-date-mp-sel'); pn.addClass('x-date-mp-sel'); this.mpSelYear = pn.dom.xyear; } else if(el.is('a.x-date-mp-prev')){ this.updateMPYear(this.mpyear-10); } else if(el.is('a.x-date-mp-next')){ this.updateMPYear(this.mpyear+10); } }, onMonthDblClick : function(e, t){ e.stopEvent(); var el = new Ext.Element(t), pn; if(pn = el.up('td.x-date-mp-month', 2)){ this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate())); this.hideMonthPicker(); } else if(pn = el.up('td.x-date-mp-year', 2)){ this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate())); this.hideMonthPicker(); } }, hideMonthPicker : function(disableAnim){ if(this.monthPicker){ if(disableAnim === true){ this.monthPicker.hide(); }else{ this.monthPicker.slideOut('t', {duration:.2}); } } }, showPrevMonth : function(e){ this.update(this.activeDate.add("mo", -1)); }, showNextMonth : function(e){ this.update(this.activeDate.add("mo", 1)); }, showPrevYear : function(){ this.update(this.activeDate.add("y", -1)); }, showNextYear : function(){ this.update(this.activeDate.add("y", 1)); }, handleMouseWheel : function(e){ var delta = e.getWheelDelta(); if(delta > 0){ this.showPrevMonth(); e.stopEvent(); } else if(delta < 0){ this.showNextMonth(); e.stopEvent(); } }, handleDateClick : function(e, t){ e.stopEvent(); if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){ this.setValue(new Date(t.dateValue)); this.fireEvent("select", this, this.value); } }, selectToday : function(){ this.setValue(new Date().clearTime()); this.fireEvent("select", this, this.value); }, update : function(date){ var vd = this.activeDate; this.activeDate = date; if(vd && this.el){ var t = date.getTime(); if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){ this.cells.removeClass("x-date-selected"); this.cells.each(function(c){ if(c.dom.firstChild.dateValue == t){ c.addClass("x-date-selected"); setTimeout(function(){ try{c.dom.firstChild.focus();}catch(e){} }, 50); return false; } }); return; } } var days = date.getDaysInMonth(); var firstOfMonth = date.getFirstDateOfMonth(); var startingPos = firstOfMonth.getDay()-this.startDay; if(startingPos <= this.startDay){ startingPos += 7; } var pm = date.add("mo", -1); var prevStart = pm.getDaysInMonth()-startingPos; var cells = this.cells.elements; var textEls = this.textNodes; days += startingPos; var day = 86400000; var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime(); var today = new Date().clearTime().getTime(); var sel = date.clearTime().getTime(); var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY; var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY; var ddMatch = this.disabledDatesRE; var ddText = this.disabledDatesText; var ddays = this.disabledDays ? this.disabledDays.join("") : false; var ddaysText = this.disabledDaysText; var format = this.format; var setCellClass = function(cal, cell){ cell.title = ""; var t = d.getTime(); cell.firstChild.dateValue = t; if(t == today){ cell.className += " x-date-today"; cell.title = cal.todayText; } if(t == sel){ cell.className += " x-date-selected"; setTimeout(function(){ try{cell.firstChild.focus();}catch(e){} }, 50); } if(t < min) { cell.className = " x-date-disabled"; cell.title = cal.minText; return; } if(t > max) { cell.className = " x-date-disabled"; cell.title = cal.maxText; return; } if(ddays){ if(ddays.indexOf(d.getDay()) != -1){ cell.title = ddaysText; cell.className = " x-date-disabled"; } } if(ddMatch && format){ var fvalue = d.dateFormat(format); if(ddMatch.test(fvalue)){ cell.title = ddText.replace("%0", fvalue); cell.className = " x-date-disabled"; } } }; var i = 0; for(; i < startingPos; i++) { textEls[i].innerHTML = (++prevStart); d.setDate(d.getDate()+1); cells[i].className = "x-date-prevday"; setCellClass(this, cells[i]); } for(; i < days; i++){ intDay = i - startingPos + 1; textEls[i].innerHTML = (intDay); d.setDate(d.getDate()+1); cells[i].className = "x-date-active"; setCellClass(this, cells[i]); } var extraDays = 0; for(; i < 42; i++) { textEls[i].innerHTML = (++extraDays); d.setDate(d.getDate()+1); cells[i].className = "x-date-nextday"; setCellClass(this, cells[i]); } this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear()); if(!this.internalRender){ var main = this.el.dom.firstChild; var w = main.offsetWidth; this.el.setWidth(w + this.el.getBorderWidth("lr")); Ext.fly(main).setWidth(w); this.internalRender = true; if(Ext.isOpera && !this.secondPass){ main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px"; this.secondPass = true; this.update.defer(10, this, [date]); } } }, beforeDestroy : function() { this.mbtn.destroy(); this.todayBtn.destroy(); } }); Ext.reg('datepicker', Ext.DatePicker); Ext.TabPanel = Ext.extend(Ext.Panel, { monitorResize : true, deferredRender : true, tabWidth: 120, minTabWidth: 30, resizeTabs:false, enableTabScroll: false, scrollIncrement : 0, scrollRepeatInterval : 400, scrollDuration : .35, animScroll : true, tabPosition: 'top', baseCls: 'x-tab-panel', autoTabs : false, autoTabSelector:'div.x-tab', activeTab : null, tabMargin : 2, plain: false, wheelIncrement : 20, idDelimiter : '__', itemCls : 'x-tab-item', elements: 'body', headerAsText: false, frame: false, hideBorders:true, initComponent : function(){ this.frame = false; Ext.TabPanel.superclass.initComponent.call(this); this.addEvents( 'beforetabchange', 'tabchange', 'contextmenu' ); this.setLayout(new Ext.layout.CardLayout({ deferredRender: this.deferredRender })); if(this.tabPosition == 'top'){ this.elements += ',header'; this.stripTarget = 'header'; }else { this.elements += ',footer'; this.stripTarget = 'footer'; } if(!this.stack){ this.stack = Ext.TabPanel.AccessStack(); } this.initItems(); }, render : function(){ Ext.TabPanel.superclass.render.apply(this, arguments); if(this.activeTab !== undefined){ var item = this.activeTab; delete this.activeTab; this.setActiveTab(item); } }, onRender : function(ct, position){ Ext.TabPanel.superclass.onRender.call(this, ct, position); if(this.plain){ var pos = this.tabPosition == 'top' ? 'header' : 'footer'; this[pos].addClass('x-tab-panel-'+pos+'-plain'); } var st = this[this.stripTarget]; this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{ tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}}); this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'}); this.strip = new Ext.Element(this.stripWrap.dom.firstChild); this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'}); this.strip.createChild({cls:'x-clear'}); this.body.addClass('x-tab-panel-body-'+this.tabPosition); if(!this.itemTpl){ var tt = new Ext.Template( '<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>', '<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">', '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>', '</em></a></li>' ); tt.disableFormats = true; tt.compile(); Ext.TabPanel.prototype.itemTpl = tt; } this.items.each(this.initTab, this); }, afterRender : function(){ Ext.TabPanel.superclass.afterRender.call(this); if(this.autoTabs){ this.readTabs(false); } }, initEvents : function(){ Ext.TabPanel.superclass.initEvents.call(this); this.on('add', this.onAdd, this); this.on('remove', this.onRemove, this); this.strip.on('mousedown', this.onStripMouseDown, this); this.strip.on('click', this.onStripClick, this); this.strip.on('contextmenu', this.onStripContextMenu, this); if(this.enableTabScroll){ this.strip.on('mousewheel', this.onWheel, this); } }, findTargets : function(e){ var item = null; var itemEl = e.getTarget('li', this.strip); if(itemEl){ item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]); if(item.disabled){ return { close : null, item : null, el : null }; } } return { close : e.getTarget('.x-tab-strip-close', this.strip), item : item, el : itemEl }; }, onStripMouseDown : function(e){ e.preventDefault(); if(e.button != 0){ return; } var t = this.findTargets(e); if(t.close){ this.remove(t.item); return; } if(t.item && t.item != this.activeTab){ this.setActiveTab(t.item); } }, onStripClick : function(e){ var t = this.findTargets(e); if(!t.close && t.item && t.item != this.activeTab){ this.setActiveTab(t.item); } }, onStripContextMenu : function(e){ e.preventDefault(); var t = this.findTargets(e); if(t.item){ this.fireEvent('contextmenu', this, t.item, e); } }, readTabs : function(removeExisting){ if(removeExisting === true){ this.items.each(function(item){ this.remove(item); }, this); } var tabs = this.el.query(this.autoTabSelector); for(var i = 0, len = tabs.length; i < len; i++){ var tab = tabs[i]; var title = tab.getAttribute('title'); tab.removeAttribute('title'); this.add({ title: title, el: tab }); } }, initTab : function(item, index){ var before = this.strip.dom.childNodes[index]; var cls = item.closable ? 'x-tab-strip-closable' : ''; if(item.disabled){ cls += ' x-item-disabled'; } if(item.iconCls){ cls += ' x-tab-with-icon'; } if(item.tabCls){ cls += ' ' + item.tabCls; } var p = { id: this.id + this.idDelimiter + item.getItemId(), text: item.title, cls: cls, iconCls: item.iconCls || '' }; var el = before ? this.itemTpl.insertBefore(before, p) : this.itemTpl.append(this.strip, p); Ext.fly(el).addClassOnOver('x-tab-strip-over'); if(item.tabTip){ Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip; } item.on('disable', this.onItemDisabled, this); item.on('enable', this.onItemEnabled, this); item.on('titlechange', this.onItemTitleChanged, this); item.on('beforeshow', this.onBeforeShowItem, this); }, onAdd : function(tp, item, index){ this.initTab(item, index); if(this.items.getCount() == 1){ this.syncSize(); } this.delegateUpdates(); }, onBeforeAdd : function(item){ var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item); if(existing){ this.setActiveTab(item); return false; } Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments); var es = item.elements; item.elements = es ? es.replace(',header', '') : es; item.border = (item.border === true); }, onRemove : function(tp, item){ Ext.removeNode(this.getTabEl(item)); this.stack.remove(item); if(item == this.activeTab){ var next = this.stack.next(); if(next){ this.setActiveTab(next); }else{ this.setActiveTab(0); } } this.delegateUpdates(); }, onBeforeShowItem : function(item){ if(item != this.activeTab){ this.setActiveTab(item); return false; } }, onItemDisabled : function(item){ var el = this.getTabEl(item); if(el){ Ext.fly(el).addClass('x-item-disabled'); } this.stack.remove(item); }, onItemEnabled : function(item){ var el = this.getTabEl(item); if(el){ Ext.fly(el).removeClass('x-item-disabled'); } }, onItemTitleChanged : function(item){ var el = this.getTabEl(item); if(el){ Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title; } }, getTabEl : function(item){ var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId(); return document.getElementById(this.id+this.idDelimiter+itemId); }, onResize : function(){ Ext.TabPanel.superclass.onResize.apply(this, arguments); this.delegateUpdates(); }, beginUpdate : function(){ this.suspendUpdates = true; }, endUpdate : function(){ this.suspendUpdates = false; this.delegateUpdates(); }, hideTabStripItem : function(item){ item = this.getComponent(item); var el = this.getTabEl(item); if(el){ el.style.display = 'none'; this.delegateUpdates(); } }, unhideTabStripItem : function(item){ item = this.getComponent(item); var el = this.getTabEl(item); if(el){ el.style.display = ''; this.delegateUpdates(); } }, delegateUpdates : function(){ if(this.suspendUpdates){ return; } if(this.resizeTabs && this.rendered){ this.autoSizeTabs(); } if(this.enableTabScroll && this.rendered){ this.autoScrollTabs(); } }, autoSizeTabs : function(){ var count = this.items.length; var ce = this.tabPosition != 'bottom' ? 'header' : 'footer'; var ow = this[ce].dom.offsetWidth; var aw = this[ce].dom.clientWidth; if(!this.resizeTabs || count < 1 || !aw){ return; } var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); this.lastTabWidth = each; var lis = this.stripWrap.dom.getElementsByTagName('li'); for(var i = 0, len = lis.length-1; i < len; i++) { var li = lis[i]; var inner = li.childNodes[1].firstChild.firstChild; var tw = li.offsetWidth; var iw = inner.offsetWidth; inner.style.width = (each - (tw-iw)) + 'px'; } }, adjustBodyWidth : function(w){ if(this.header){ this.header.setWidth(w); } if(this.footer){ this.footer.setWidth(w); } return w; }, setActiveTab : function(item){ item = this.getComponent(item); if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){ return; } if(!this.rendered){ this.activeTab = item; return; } if(this.activeTab != item){ if(this.activeTab){ var oldEl = this.getTabEl(this.activeTab); if(oldEl){ Ext.fly(oldEl).removeClass('x-tab-strip-active'); } this.activeTab.fireEvent('deactivate', this.activeTab); } var el = this.getTabEl(item); Ext.fly(el).addClass('x-tab-strip-active'); this.activeTab = item; this.stack.add(item); this.layout.setActiveItem(item); if(this.layoutOnTabChange && item.doLayout){ item.doLayout(); } if(this.scrolling){ this.scrollToTab(item, this.animScroll); } item.fireEvent('activate', item); this.fireEvent('tabchange', this, item); } }, getActiveTab : function(){ return this.activeTab || null; }, getItem : function(item){ return this.getComponent(item); }, autoScrollTabs : function(){ var count = this.items.length; var ow = this.header.dom.offsetWidth; var tw = this.header.dom.clientWidth; var wrap = this.stripWrap; var wd = wrap.dom; var cw = wd.offsetWidth; var pos = this.getScrollPos(); var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos; if(!this.enableTabScroll || count < 1 || cw < 20){ return; } if(l <= tw){ wd.scrollLeft = 0; wrap.setWidth(tw); if(this.scrolling){ this.scrolling = false; this.header.removeClass('x-tab-scrolling'); this.scrollLeft.hide(); this.scrollRight.hide(); if(Ext.isAir){ wd.style.marginLeft = ''; wd.style.marginRight = ''; } } }else{ if(!this.scrolling){ this.header.addClass('x-tab-scrolling'); if(Ext.isAir){ wd.style.marginLeft = '18px'; wd.style.marginRight = '18px'; } } tw -= wrap.getMargins('lr'); wrap.setWidth(tw > 20 ? tw : 20); if(!this.scrolling){ if(!this.scrollLeft){ this.createScrollers(); }else{ this.scrollLeft.show(); this.scrollRight.show(); } } this.scrolling = true; if(pos > (l-tw)){ wd.scrollLeft = l-tw; }else{ this.scrollToTab(this.activeTab, false); } this.updateScrollButtons(); } }, createScrollers : function(){ var h = this.stripWrap.dom.offsetHeight; var sl = this.header.insertFirst({ cls:'x-tab-scroller-left' }); sl.setHeight(h); sl.addClassOnOver('x-tab-scroller-left-over'); this.leftRepeater = new Ext.util.ClickRepeater(sl, { interval : this.scrollRepeatInterval, handler: this.onScrollLeft, scope: this }); this.scrollLeft = sl; var sr = this.header.insertFirst({ cls:'x-tab-scroller-right' }); sr.setHeight(h); sr.addClassOnOver('x-tab-scroller-right-over'); this.rightRepeater = new Ext.util.ClickRepeater(sr, { interval : this.scrollRepeatInterval, handler: this.onScrollRight, scope: this }); this.scrollRight = sr; }, getScrollWidth : function(){ return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos(); }, getScrollPos : function(){ return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0; }, getScrollArea : function(){ return parseInt(this.stripWrap.dom.clientWidth, 10) || 0; }, getScrollAnim : function(){ return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this}; }, getScrollIncrement : function(){ return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100); }, scrollToTab : function(item, animate){ if(!item){ return; } var el = this.getTabEl(item); var pos = this.getScrollPos(), area = this.getScrollArea(); var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos; var right = left + el.offsetWidth; if(left < pos){ this.scrollTo(left, animate); }else if(right > (pos + area)){ this.scrollTo(right - area, animate); } }, scrollTo : function(pos, animate){ this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false); if(!animate){ this.updateScrollButtons(); } }, onWheel : function(e){ var d = e.getWheelDelta()*this.wheelIncrement*-1; e.stopEvent(); var pos = this.getScrollPos(); var newpos = pos + d; var sw = this.getScrollWidth()-this.getScrollArea(); var s = Math.max(0, Math.min(sw, newpos)); if(s != pos){ this.scrollTo(s, false); } }, onScrollRight : function(){ var sw = this.getScrollWidth()-this.getScrollArea(); var pos = this.getScrollPos(); var s = Math.min(sw, pos + this.getScrollIncrement()); if(s != pos){ this.scrollTo(s, this.animScroll); } }, onScrollLeft : function(){ var pos = this.getScrollPos(); var s = Math.max(0, pos - this.getScrollIncrement()); if(s != pos){ this.scrollTo(s, this.animScroll); } }, updateScrollButtons : function(){ var pos = this.getScrollPos(); this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled'); this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled'); } }); Ext.reg('tabpanel', Ext.TabPanel); Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab; Ext.TabPanel.AccessStack = function(){ var items = []; return { add : function(item){ items.push(item); if(items.length > 10){ items.shift(); } }, remove : function(item){ var s = []; for(var i = 0, len = items.length; i < len; i++) { if(items[i] != item){ s.push(items[i]); } } items = s; }, next : function(){ return items.pop(); } }; }; Ext.Button = Ext.extend(Ext.Component, { hidden : false, disabled : false, pressed : false, enableToggle: false, menuAlign : "tl-bl?", type : 'button', menuClassTarget: 'tr', clickEvent : 'click', handleMouseEvents : true, tooltipType : 'qtip', buttonSelector : "button:first", initComponent : function(){ Ext.Button.superclass.initComponent.call(this); this.addEvents( "click", "toggle", 'mouseover', 'mouseout', 'menushow', 'menuhide', 'menutriggerover', 'menutriggerout' ); if(this.menu){ this.menu = Ext.menu.MenuMgr.get(this.menu); } if(typeof this.toggleGroup === 'string'){ this.enableToggle = true; } }, onRender : function(ct, position){ if(!this.template){ if(!Ext.Button.buttonTemplate){ Ext.Button.buttonTemplate = new Ext.Template( '<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>', '<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>', "</tr></tbody></table>"); } this.template = Ext.Button.buttonTemplate; } var btn, targs = [this.text || '&#160;', this.type]; if(position){ btn = this.template.insertBefore(position, targs, true); }else{ btn = this.template.append(ct, targs, true); } var btnEl = btn.child(this.buttonSelector); btnEl.on('focus', this.onFocus, this); btnEl.on('blur', this.onBlur, this); this.initButtonEl(btn, btnEl); if(this.menu){ this.el.child(this.menuClassTarget).addClass("x-btn-with-menu"); } Ext.ButtonToggleMgr.register(this); }, initButtonEl : function(btn, btnEl){ this.el = btn; btn.addClass("x-btn"); if(this.icon){ btnEl.setStyle('background-image', 'url(' +this.icon +')'); } if(this.iconCls){ btnEl.addClass(this.iconCls); if(!this.cls){ btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon'); } } if(this.tabIndex !== undefined){ btnEl.dom.tabIndex = this.tabIndex; } if(this.tooltip){ if(typeof this.tooltip == 'object'){ Ext.QuickTips.register(Ext.apply({ target: btnEl.id }, this.tooltip)); } else { btnEl.dom[this.tooltipType] = this.tooltip; } } if(this.pressed){ this.el.addClass("x-btn-pressed"); } if(this.handleMouseEvents){ btn.on("mouseover", this.onMouseOver, this); btn.on("mousedown", this.onMouseDown, this); } if(this.menu){ this.menu.on("show", this.onMenuShow, this); this.menu.on("hide", this.onMenuHide, this); } if(this.id){ this.el.dom.id = this.el.id = this.id; } if(this.repeat){ var repeater = new Ext.util.ClickRepeater(btn, typeof this.repeat == "object" ? this.repeat : {} ); repeater.on("click", this.onClick, this); } btn.on(this.clickEvent, this.onClick, this); }, afterRender : function(){ Ext.Button.superclass.afterRender.call(this); if(Ext.isIE6){ this.autoWidth.defer(1, this); }else{ this.autoWidth(); } }, setIconClass : function(cls){ if(this.el){ this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls); } this.iconCls = cls; }, beforeDestroy: function(){ if(this.rendered){ var btn = this.el.child(this.buttonSelector); if(btn){ btn.removeAllListeners(); } } if(this.menu){ Ext.destroy(this.menu); } }, onDestroy : function(){ if(this.rendered){ Ext.ButtonToggleMgr.unregister(this); } }, autoWidth : function(){ if(this.el){ this.el.setWidth("auto"); if(Ext.isIE7 && Ext.isStrict){ var ib = this.el.child(this.buttonSelector); if(ib && ib.getWidth() > 20){ ib.clip(); ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr')); } } if(this.minWidth){ if(this.el.getWidth() < this.minWidth){ this.el.setWidth(this.minWidth); } } } }, setHandler : function(handler, scope){ this.handler = handler; this.scope = scope; }, setText : function(text){ this.text = text; if(this.el){ this.el.child("td.x-btn-center " + this.buttonSelector).update(text); } this.autoWidth(); }, getText : function(){ return this.text; }, toggle : function(state){ state = state === undefined ? !this.pressed : state; if(state != this.pressed){ if(state){ this.el.addClass("x-btn-pressed"); this.pressed = true; this.fireEvent("toggle", this, true); }else{ this.el.removeClass("x-btn-pressed"); this.pressed = false; this.fireEvent("toggle", this, false); } if(this.toggleHandler){ this.toggleHandler.call(this.scope || this, this, state); } } }, focus : function(){ this.el.child(this.buttonSelector).focus(); }, onDisable : function(){ if(this.el){ if(!Ext.isIE6 || !this.text){ this.el.addClass(this.disabledClass); } this.el.dom.disabled = true; } this.disabled = true; }, onEnable : function(){ if(this.el){ if(!Ext.isIE6 || !this.text){ this.el.removeClass(this.disabledClass); } this.el.dom.disabled = false; } this.disabled = false; }, showMenu : function(){ if(this.menu){ this.menu.show(this.el, this.menuAlign); } return this; }, hideMenu : function(){ if(this.menu){ this.menu.hide(); } return this; }, hasVisibleMenu : function(){ return this.menu && this.menu.isVisible(); }, onClick : function(e){ if(e){ e.preventDefault(); } if(e.button != 0){ return; } if(!this.disabled){ if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){ this.toggle(); } if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){ this.showMenu(); } this.fireEvent("click", this, e); if(this.handler){ this.handler.call(this.scope || this, this, e); } } }, isMenuTriggerOver : function(e, internal){ return this.menu && !internal; }, isMenuTriggerOut : function(e, internal){ return this.menu && !internal; }, onMouseOver : function(e){ if(!this.disabled){ var internal = e.within(this.el, true); if(!internal){ this.el.addClass("x-btn-over"); Ext.getDoc().on('mouseover', this.monitorMouseOver, this); this.fireEvent('mouseover', this, e); } if(this.isMenuTriggerOver(e, internal)){ this.fireEvent('menutriggerover', this, this.menu, e); } } }, monitorMouseOver : function(e){ if(e.target != this.el.dom && !e.within(this.el)){ Ext.getDoc().un('mouseover', this.monitorMouseOver, this); this.onMouseOut(e); } }, onMouseOut : function(e){ var internal = e.within(this.el) && e.target != this.el.dom; this.el.removeClass("x-btn-over"); this.fireEvent('mouseout', this, e); if(this.isMenuTriggerOut(e, internal)){ this.fireEvent('menutriggerout', this, this.menu, e); } }, onFocus : function(e){ if(!this.disabled){ this.el.addClass("x-btn-focus"); } }, onBlur : function(e){ this.el.removeClass("x-btn-focus"); }, getClickEl : function(e, isUp){ return this.el; }, onMouseDown : function(e){ if(!this.disabled && e.button == 0){ this.getClickEl(e).addClass("x-btn-click"); Ext.getDoc().on('mouseup', this.onMouseUp, this); } }, onMouseUp : function(e){ if(e.button == 0){ this.getClickEl(e, true).removeClass("x-btn-click"); Ext.getDoc().un('mouseup', this.onMouseUp, this); } }, onMenuShow : function(e){ this.ignoreNextClick = 0; this.el.addClass("x-btn-menu-active"); this.fireEvent('menushow', this, this.menu); }, onMenuHide : function(e){ this.el.removeClass("x-btn-menu-active"); this.ignoreNextClick = this.restoreClick.defer(250, this); this.fireEvent('menuhide', this, this.menu); }, restoreClick : function(){ this.ignoreNextClick = 0; } }); Ext.reg('button', Ext.Button); Ext.ButtonToggleMgr = function(){ var groups = {}; function toggleGroup(btn, state){ if(state){ var g = groups[btn.toggleGroup]; for(var i = 0, l = g.length; i < l; i++){ if(g[i] != btn){ g[i].toggle(false); } } } } return { register : function(btn){ if(!btn.toggleGroup){ return; } var g = groups[btn.toggleGroup]; if(!g){ g = groups[btn.toggleGroup] = []; } g.push(btn); btn.on("toggle", toggleGroup); }, unregister : function(btn){ if(!btn.toggleGroup){ return; } var g = groups[btn.toggleGroup]; if(g){ g.remove(btn); btn.un("toggle", toggleGroup); } } }; }(); Ext.SplitButton = Ext.extend(Ext.Button, { arrowSelector : 'button:last', initComponent : function(){ Ext.SplitButton.superclass.initComponent.call(this); this.addEvents("arrowclick"); }, onRender : function(ct, position){ var tpl = new Ext.Template( '<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>', '<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>', '<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>', "</tbody></table></td><td>", '<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>', '<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>', "</tbody></table></td></tr></table>" ); var btn, targs = [this.text || '&#160;', this.type]; if(position){ btn = tpl.insertBefore(position, targs, true); }else{ btn = tpl.append(ct, targs, true); } var btnEl = btn.child(this.buttonSelector); this.initButtonEl(btn, btnEl); this.arrowBtnTable = btn.child("table:last"); if(this.arrowTooltip){ btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip; } }, autoWidth : function(){ if(this.el){ var tbl = this.el.child("table:first"); var tbl2 = this.el.child("table:last"); this.el.setWidth("auto"); tbl.setWidth("auto"); if(Ext.isIE7 && Ext.isStrict){ var ib = this.el.child(this.buttonSelector); if(ib && ib.getWidth() > 20){ ib.clip(); ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr')); } } if(this.minWidth){ if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){ tbl.setWidth(this.minWidth-tbl2.getWidth()); } } this.el.setWidth(tbl.getWidth()+tbl2.getWidth()); } }, setArrowHandler : function(handler, scope){ this.arrowHandler = handler; this.scope = scope; }, onClick : function(e){ e.preventDefault(); if(!this.disabled){ if(e.getTarget(".x-btn-menu-arrow-wrap")){ if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){ this.showMenu(); } this.fireEvent("arrowclick", this, e); if(this.arrowHandler){ this.arrowHandler.call(this.scope || this, this, e); } }else{ if(this.enableToggle){ this.toggle(); } this.fireEvent("click", this, e); if(this.handler){ this.handler.call(this.scope || this, this, e); } } } }, getClickEl : function(e, isUp){ if(!isUp){ return (this.lastClickEl = e.getTarget("table", 10, true)); } return this.lastClickEl; }, onDisable : function(){ if(this.el){ if(!Ext.isIE6){ this.el.addClass("x-item-disabled"); } this.el.child(this.buttonSelector).dom.disabled = true; this.el.child(this.arrowSelector).dom.disabled = true; } this.disabled = true; }, onEnable : function(){ if(this.el){ if(!Ext.isIE6){ this.el.removeClass("x-item-disabled"); } this.el.child(this.buttonSelector).dom.disabled = false; this.el.child(this.arrowSelector).dom.disabled = false; } this.disabled = false; }, isMenuTriggerOver : function(e){ return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true); }, isMenuTriggerOut : function(e, internal){ return this.menu && !e.within(this.arrowBtnTable); }, onDestroy : function(){ Ext.destroy(this.arrowBtnTable); Ext.SplitButton.superclass.onDestroy.call(this); } }); Ext.MenuButton = Ext.SplitButton; Ext.reg('splitbutton', Ext.SplitButton); Ext.CycleButton = Ext.extend(Ext.SplitButton, { getItemText : function(item){ if(item && this.showText === true){ var text = ''; if(this.prependText){ text += this.prependText; } text += item.text; return text; } return undefined; }, setActiveItem : function(item, suppressEvent){ if(typeof item != 'object'){ item = this.menu.items.get(item); } if(item){ if(!this.rendered){ this.text = this.getItemText(item); this.iconCls = item.iconCls; }else{ var t = this.getItemText(item); if(t){ this.setText(t); } this.setIconClass(item.iconCls); } this.activeItem = item; if(!item.checked){ item.setChecked(true, true); } if(this.forceIcon){ this.setIconClass(this.forceIcon); } if(!suppressEvent){ this.fireEvent('change', this, item); } } }, getActiveItem : function(){ return this.activeItem; }, initComponent : function(){ this.addEvents( "change" ); if(this.changeHandler){ this.on('change', this.changeHandler, this.scope||this); delete this.changeHandler; } this.itemCount = this.items.length; this.menu = {cls:'x-cycle-menu', items:[]}; var checked; for(var i = 0, len = this.itemCount; i < len; i++){ var item = this.items[i]; item.group = item.group || this.id; item.itemIndex = i; item.checkHandler = this.checkHandler; item.scope = this; item.checked = item.checked || false; this.menu.items.push(item); if(item.checked){ checked = item; } } this.setActiveItem(checked, true); Ext.CycleButton.superclass.initComponent.call(this); this.on('click', this.toggleSelected, this); }, checkHandler : function(item, pressed){ if(pressed){ this.setActiveItem(item); } }, toggleSelected : function(){ this.menu.render(); var nextIdx, checkItem; for (var i = 1; i < this.itemCount; i++) { nextIdx = (this.activeItem.itemIndex + i) % this.itemCount; checkItem = this.menu.items.itemAt(nextIdx); if (!checkItem.disabled) { checkItem.setChecked(true); break; } } } }); Ext.reg('cycle', Ext.CycleButton); Ext.Toolbar = function(config){ if(Ext.isArray(config)){ config = {buttons:config}; } Ext.Toolbar.superclass.constructor.call(this, config); }; (function(){ var T = Ext.Toolbar; Ext.extend(T, Ext.BoxComponent, { trackMenus : true, initComponent : function(){ T.superclass.initComponent.call(this); if(this.items){ this.buttons = this.items; } this.items = new Ext.util.MixedCollection(false, function(o){ return o.itemId || o.id || Ext.id(); }); }, autoCreate: { cls:'x-toolbar x-small-editor', html:'<table cellspacing="0"><tr></tr></table>' }, onRender : function(ct, position){ this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position); this.tr = this.el.child("tr", true); }, afterRender : function(){ T.superclass.afterRender.call(this); if(this.buttons){ this.add.apply(this, this.buttons); delete this.buttons; } }, add : function(){ var a = arguments, l = a.length; for(var i = 0; i < l; i++){ var el = a[i]; if(el.isFormField){ this.addField(el); }else if(el.render){ this.addItem(el); }else if(typeof el == "string"){ if(el == "separator" || el == "-"){ this.addSeparator(); }else if(el == " "){ this.addSpacer(); }else if(el == "->"){ this.addFill(); }else{ this.addText(el); } }else if(el.tagName){ this.addElement(el); }else if(typeof el == "object"){ if(el.xtype){ this.addField(Ext.ComponentMgr.create(el, 'button')); }else{ this.addButton(el); } } } }, addSeparator : function(){ return this.addItem(new T.Separator()); }, addSpacer : function(){ return this.addItem(new T.Spacer()); }, addFill : function(){ return this.addItem(new T.Fill()); }, addElement : function(el){ return this.addItem(new T.Item(el)); }, addItem : function(item){ var td = this.nextBlock(); this.initMenuTracking(item); item.render(td); this.items.add(item); return item; }, addButton : function(config){ if(Ext.isArray(config)){ var buttons = []; for(var i = 0, len = config.length; i < len; i++) { buttons.push(this.addButton(config[i])); } return buttons; } var b = config; if(!(config instanceof T.Button)){ b = config.split ? new T.SplitButton(config) : new T.Button(config); } var td = this.nextBlock(); this.initMenuTracking(b); b.render(td); this.items.add(b); return b; }, initMenuTracking : function(item){ if(this.trackMenus && item.menu){ item.on({ 'menutriggerover' : this.onButtonTriggerOver, 'menushow' : this.onButtonMenuShow, 'menuhide' : this.onButtonMenuHide, scope: this }) } }, addText : function(text){ return this.addItem(new T.TextItem(text)); }, insertButton : function(index, item){ if(Ext.isArray(item)){ var buttons = []; for(var i = 0, len = item.length; i < len; i++) { buttons.push(this.insertButton(index + i, item[i])); } return buttons; } if (!(item instanceof T.Button)){ item = new T.Button(item); } var td = document.createElement("td"); this.tr.insertBefore(td, this.tr.childNodes[index]); this.initMenuTracking(item); item.render(td); this.items.insert(index, item); return item; }, addDom : function(config, returnEl){ var td = this.nextBlock(); Ext.DomHelper.overwrite(td, config); var ti = new T.Item(td.firstChild); ti.render(td); this.items.add(ti); return ti; }, addField : function(field){ var td = this.nextBlock(); field.render(td); var ti = new T.Item(td.firstChild); ti.render(td); this.items.add(ti); return ti; }, nextBlock : function(){ var td = document.createElement("td"); this.tr.appendChild(td); return td; }, onDestroy : function(){ Ext.Toolbar.superclass.onDestroy.call(this); if(this.rendered){ if(this.items){ Ext.destroy.apply(Ext, this.items.items); } Ext.Element.uncache(this.tr); } }, onDisable : function(){ this.items.each(function(item){ if(item.disable){ item.disable(); } }); }, onEnable : function(){ this.items.each(function(item){ if(item.enable){ item.enable(); } }); }, onButtonTriggerOver : function(btn){ if(this.activeMenuBtn && this.activeMenuBtn != btn){ this.activeMenuBtn.hideMenu(); btn.showMenu(); this.activeMenuBtn = btn; } }, onButtonMenuShow : function(btn){ this.activeMenuBtn = btn; }, onButtonMenuHide : function(btn){ delete this.activeMenuBtn; } }); Ext.reg('toolbar', Ext.Toolbar); T.Item = function(el){ this.el = Ext.getDom(el); this.id = Ext.id(this.el); this.hidden = false; }; T.Item.prototype = { getEl : function(){ return this.el; }, render : function(td){ this.td = td; td.appendChild(this.el); }, destroy : function(){ if(this.td && this.td.parentNode){ this.td.parentNode.removeChild(this.td); } }, show: function(){ this.hidden = false; this.td.style.display = ""; }, hide: function(){ this.hidden = true; this.td.style.display = "none"; }, setVisible: function(visible){ if(visible) { this.show(); }else{ this.hide(); } }, focus : function(){ Ext.fly(this.el).focus(); }, disable : function(){ Ext.fly(this.td).addClass("x-item-disabled"); this.disabled = true; this.el.disabled = true; }, enable : function(){ Ext.fly(this.td).removeClass("x-item-disabled"); this.disabled = false; this.el.disabled = false; } }; Ext.reg('tbitem', T.Item); T.Separator = function(){ var s = document.createElement("span"); s.className = "ytb-sep"; T.Separator.superclass.constructor.call(this, s); }; Ext.extend(T.Separator, T.Item, { enable:Ext.emptyFn, disable:Ext.emptyFn, focus:Ext.emptyFn }); Ext.reg('tbseparator', T.Separator); T.Spacer = function(){ var s = document.createElement("div"); s.className = "ytb-spacer"; T.Spacer.superclass.constructor.call(this, s); }; Ext.extend(T.Spacer, T.Item, { enable:Ext.emptyFn, disable:Ext.emptyFn, focus:Ext.emptyFn }); Ext.reg('tbspacer', T.Spacer); T.Fill = Ext.extend(T.Spacer, { render : function(td){ td.style.width = '100%'; T.Fill.superclass.render.call(this, td); } }); Ext.reg('tbfill', T.Fill); T.TextItem = function(t){ var s = document.createElement("span"); s.className = "ytb-text"; s.innerHTML = t.text ? t.text : t; T.TextItem.superclass.constructor.call(this, s); }; Ext.extend(T.TextItem, T.Item, { enable:Ext.emptyFn, disable:Ext.emptyFn, focus:Ext.emptyFn }); Ext.reg('tbtext', T.TextItem); T.Button = Ext.extend(Ext.Button, { hideParent : true, onDestroy : function(){ T.Button.superclass.onDestroy.call(this); if(this.container){ this.container.remove(); } } }); Ext.reg('tbbutton', T.Button); T.SplitButton = Ext.extend(Ext.SplitButton, { hideParent : true, onDestroy : function(){ T.SplitButton.superclass.onDestroy.call(this); if(this.container){ this.container.remove(); } } }); Ext.reg('tbsplit', T.SplitButton); T.MenuButton = T.SplitButton; })(); Ext.PagingToolbar = Ext.extend(Ext.Toolbar, { pageSize: 20, displayMsg : 'Displaying {0} - {1} of {2}', emptyMsg : 'No data to display', beforePageText : "Page", afterPageText : "of {0}", firstText : "First Page", prevText : "Previous Page", nextText : "Next Page", lastText : "Last Page", refreshText : "Refresh", paramNames : {start: 'start', limit: 'limit'}, initComponent : function(){ Ext.PagingToolbar.superclass.initComponent.call(this); this.cursor = 0; this.bind(this.store); }, onRender : function(ct, position){ Ext.PagingToolbar.superclass.onRender.call(this, ct, position); this.first = this.addButton({ tooltip: this.firstText, iconCls: "x-tbar-page-first", disabled: true, handler: this.onClick.createDelegate(this, ["first"]) }); this.prev = this.addButton({ tooltip: this.prevText, iconCls: "x-tbar-page-prev", disabled: true, handler: this.onClick.createDelegate(this, ["prev"]) }); this.addSeparator(); this.add(this.beforePageText); this.field = Ext.get(this.addDom({ tag: "input", type: "text", size: "3", value: "1", cls: "x-tbar-page-number" }).el); this.field.on("keydown", this.onPagingKeydown, this); this.field.on("focus", function(){this.dom.select();}); this.afterTextEl = this.addText(String.format(this.afterPageText, 1)); this.field.setHeight(18); this.addSeparator(); this.next = this.addButton({ tooltip: this.nextText, iconCls: "x-tbar-page-next", disabled: true, handler: this.onClick.createDelegate(this, ["next"]) }); this.last = this.addButton({ tooltip: this.lastText, iconCls: "x-tbar-page-last", disabled: true, handler: this.onClick.createDelegate(this, ["last"]) }); this.addSeparator(); this.loading = this.addButton({ tooltip: this.refreshText, iconCls: "x-tbar-loading", handler: this.onClick.createDelegate(this, ["refresh"]) }); if(this.displayInfo){ this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'}); } if(this.dsLoaded){ this.onLoad.apply(this, this.dsLoaded); } }, updateInfo : function(){ if(this.displayEl){ var count = this.store.getCount(); var msg = count == 0 ? this.emptyMsg : String.format( this.displayMsg, this.cursor+1, this.cursor+count, this.store.getTotalCount() ); this.displayEl.update(msg); } }, onLoad : function(store, r, o){ if(!this.rendered){ this.dsLoaded = [store, r, o]; return; } this.cursor = o.params ? o.params[this.paramNames.start] : 0; var d = this.getPageData(), ap = d.activePage, ps = d.pages; this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages); this.field.dom.value = ap; this.first.setDisabled(ap == 1); this.prev.setDisabled(ap == 1); this.next.setDisabled(ap == ps); this.last.setDisabled(ap == ps); this.loading.enable(); this.updateInfo(); }, getPageData : function(){ var total = this.store.getTotalCount(); return { total : total, activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize), pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize) }; }, onLoadError : function(){ if(!this.rendered){ return; } this.loading.enable(); }, readPage : function(d){ var v = this.field.dom.value, pageNum; if (!v || isNaN(pageNum = parseInt(v, 10))) { this.field.dom.value = d.activePage; return false; } return pageNum; }, onPagingKeydown : function(e){ var k = e.getKey(), d = this.getPageData(), pageNum; if (k == e.RETURN) { e.stopEvent(); if(pageNum = this.readPage(d)){ pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1; this.doLoad(pageNum * this.pageSize); } }else if (k == e.HOME || k == e.END){ e.stopEvent(); pageNum = k == e.HOME ? 1 : d.pages; this.field.dom.value = pageNum; }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){ e.stopEvent(); if(pageNum = this.readPage(d)){ var increment = e.shiftKey ? 10 : 1; if(k == e.DOWN || k == e.PAGEDOWN){ increment *= -1; } pageNum += increment; if(pageNum >= 1 & pageNum <= d.pages){ this.field.dom.value = pageNum; } } } }, beforeLoad : function(){ if(this.rendered && this.loading){ this.loading.disable(); } }, doLoad : function(start){ var o = {}, pn = this.paramNames; o[pn.start] = start; o[pn.limit] = this.pageSize; this.store.load({params:o}); }, onClick : function(which){ var store = this.store; switch(which){ case "first": this.doLoad(0); break; case "prev": this.doLoad(Math.max(0, this.cursor-this.pageSize)); break; case "next": this.doLoad(this.cursor+this.pageSize); break; case "last": var total = store.getTotalCount(); var extra = total % this.pageSize; var lastStart = extra ? (total - extra) : total-this.pageSize; this.doLoad(lastStart); break; case "refresh": this.doLoad(this.cursor); break; } }, unbind : function(store){ store = Ext.StoreMgr.lookup(store); store.un("beforeload", this.beforeLoad, this); store.un("load", this.onLoad, this); store.un("loadexception", this.onLoadError, this); this.store = undefined; }, bind : function(store){ store = Ext.StoreMgr.lookup(store); store.on("beforeload", this.beforeLoad, this); store.on("load", this.onLoad, this); store.on("loadexception", this.onLoadError, this); this.store = store; } }); Ext.reg('paging', Ext.PagingToolbar); Ext.Resizable = function(el, config){ this.el = Ext.get(el); if(config && config.wrap){ config.resizeChild = this.el; this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"}); this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap"; this.el.setStyle("overflow", "hidden"); this.el.setPositioning(config.resizeChild.getPositioning()); config.resizeChild.clearPositioning(); if(!config.width || !config.height){ var csize = config.resizeChild.getSize(); this.el.setSize(csize.width, csize.height); } if(config.pinned && !config.adjustments){ config.adjustments = "auto"; } } this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"}); this.proxy.unselectable(); this.proxy.enableDisplayMode('block'); Ext.apply(this, config); if(this.pinned){ this.disableTrackOver = true; this.el.addClass("x-resizable-pinned"); } var position = this.el.getStyle("position"); if(position != "absolute" && position != "fixed"){ this.el.setStyle("position", "relative"); } if(!this.handles){ this.handles = 's,e,se'; if(this.multiDirectional){ this.handles += ',n,w'; } } if(this.handles == "all"){ this.handles = "n s e w ne nw se sw"; } var hs = this.handles.split(/\s*?[,;]\s*?| /); var ps = Ext.Resizable.positions; for(var i = 0, len = hs.length; i < len; i++){ if(hs[i] && ps[hs[i]]){ var pos = ps[hs[i]]; this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent); } } this.corner = this.southeast; if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){ this.updateBox = true; } this.activeHandle = null; if(this.resizeChild){ if(typeof this.resizeChild == "boolean"){ this.resizeChild = Ext.get(this.el.dom.firstChild, true); }else{ this.resizeChild = Ext.get(this.resizeChild, true); } } if(this.adjustments == "auto"){ var rc = this.resizeChild; var hw = this.west, he = this.east, hn = this.north, hs = this.south; if(rc && (hw || hn)){ rc.position("relative"); rc.setLeft(hw ? hw.el.getWidth() : 0); rc.setTop(hn ? hn.el.getHeight() : 0); } this.adjustments = [ (he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0), (hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1 ]; } if(this.draggable){ this.dd = this.dynamic ? this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id}); this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id); } this.addEvents( "beforeresize", "resize" ); if(this.width !== null && this.height !== null){ this.resizeTo(this.width, this.height); }else{ this.updateChildSize(); } if(Ext.isIE){ this.el.dom.style.zoom = 1; } Ext.Resizable.superclass.constructor.call(this); }; Ext.extend(Ext.Resizable, Ext.util.Observable, { resizeChild : false, adjustments : [0, 0], minWidth : 5, minHeight : 5, maxWidth : 10000, maxHeight : 10000, enabled : true, animate : false, duration : .35, dynamic : false, handles : false, multiDirectional : false, disableTrackOver : false, easing : 'easeOutStrong', widthIncrement : 0, heightIncrement : 0, pinned : false, width : null, height : null, preserveRatio : false, transparent: false, minX: 0, minY: 0, draggable: false, resizeTo : function(width, height){ this.el.setSize(width, height); this.updateChildSize(); this.fireEvent("resize", this, width, height, null); }, startSizing : function(e, handle){ this.fireEvent("beforeresize", this, e); if(this.enabled){ if(!this.overlay){ this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: "&#160;"}, Ext.getBody()); this.overlay.unselectable(); this.overlay.enableDisplayMode("block"); this.overlay.on("mousemove", this.onMouseMove, this); this.overlay.on("mouseup", this.onMouseUp, this); } this.overlay.setStyle("cursor", handle.el.getStyle("cursor")); this.resizing = true; this.startBox = this.el.getBox(); this.startPoint = e.getXY(); this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0], (this.startBox.y + this.startBox.height) - this.startPoint[1]]; this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true)); this.overlay.show(); if(this.constrainTo) { var ct = Ext.get(this.constrainTo); this.resizeRegion = ct.getRegion().adjust( ct.getFrameWidth('t'), ct.getFrameWidth('l'), -ct.getFrameWidth('b'), -ct.getFrameWidth('r') ); } this.proxy.setStyle('visibility', 'hidden'); this.proxy.show(); this.proxy.setBox(this.startBox); if(!this.dynamic){ this.proxy.setStyle('visibility', 'visible'); } } }, onMouseDown : function(handle, e){ if(this.enabled){ e.stopEvent(); this.activeHandle = handle; this.startSizing(e, handle); } }, onMouseUp : function(e){ var size = this.resizeElement(); this.resizing = false; this.handleOut(); this.overlay.hide(); this.proxy.hide(); this.fireEvent("resize", this, size.width, size.height, e); }, updateChildSize : function(){ if(this.resizeChild){ var el = this.el; var child = this.resizeChild; var adj = this.adjustments; if(el.dom.offsetWidth){ var b = el.getSize(true); child.setSize(b.width+adj[0], b.height+adj[1]); } if(Ext.isIE){ setTimeout(function(){ if(el.dom.offsetWidth){ var b = el.getSize(true); child.setSize(b.width+adj[0], b.height+adj[1]); } }, 10); } } }, snap : function(value, inc, min){ if(!inc || !value) return value; var newValue = value; var m = value % inc; if(m > 0){ if(m > (inc/2)){ newValue = value + (inc-m); }else{ newValue = value - m; } } return Math.max(min, newValue); }, resizeElement : function(){ var box = this.proxy.getBox(); if(this.updateBox){ this.el.setBox(box, false, this.animate, this.duration, null, this.easing); }else{ this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing); } this.updateChildSize(); if(!this.dynamic){ this.proxy.hide(); } return box; }, constrain : function(v, diff, m, mx){ if(v - diff < m){ diff = v - m; }else if(v - diff > mx){ diff = mx - v; } return diff; }, onMouseMove : function(e){ if(this.enabled){ try{ if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) { return; } var curSize = this.curSize || this.startBox; var x = this.startBox.x, y = this.startBox.y; var ox = x, oy = y; var w = curSize.width, h = curSize.height; var ow = w, oh = h; var mw = this.minWidth, mh = this.minHeight; var mxw = this.maxWidth, mxh = this.maxHeight; var wi = this.widthIncrement; var hi = this.heightIncrement; var eventXY = e.getXY(); var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0])); var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1])); var pos = this.activeHandle.position; switch(pos){ case "east": w += diffX; w = Math.min(Math.max(mw, w), mxw); break; case "south": h += diffY; h = Math.min(Math.max(mh, h), mxh); break; case "southeast": w += diffX; h += diffY; w = Math.min(Math.max(mw, w), mxw); h = Math.min(Math.max(mh, h), mxh); break; case "north": diffY = this.constrain(h, diffY, mh, mxh); y += diffY; h -= diffY; break; case "west": diffX = this.constrain(w, diffX, mw, mxw); x += diffX; w -= diffX; break; case "northeast": w += diffX; w = Math.min(Math.max(mw, w), mxw); diffY = this.constrain(h, diffY, mh, mxh); y += diffY; h -= diffY; break; case "northwest": diffX = this.constrain(w, diffX, mw, mxw); diffY = this.constrain(h, diffY, mh, mxh); y += diffY; h -= diffY; x += diffX; w -= diffX; break; case "southwest": diffX = this.constrain(w, diffX, mw, mxw); h += diffY; h = Math.min(Math.max(mh, h), mxh); x += diffX; w -= diffX; break; } var sw = this.snap(w, wi, mw); var sh = this.snap(h, hi, mh); if(sw != w || sh != h){ switch(pos){ case "northeast": y -= sh - h; break; case "north": y -= sh - h; break; case "southwest": x -= sw - w; break; case "west": x -= sw - w; break; case "northwest": x -= sw - w; y -= sh - h; break; } w = sw; h = sh; } if(this.preserveRatio){ switch(pos){ case "southeast": case "east": h = oh * (w/ow); h = Math.min(Math.max(mh, h), mxh); w = ow * (h/oh); break; case "south": w = ow * (h/oh); w = Math.min(Math.max(mw, w), mxw); h = oh * (w/ow); break; case "northeast": w = ow * (h/oh); w = Math.min(Math.max(mw, w), mxw); h = oh * (w/ow); break; case "north": var tw = w; w = ow * (h/oh); w = Math.min(Math.max(mw, w), mxw); h = oh * (w/ow); x += (tw - w) / 2; break; case "southwest": h = oh * (w/ow); h = Math.min(Math.max(mh, h), mxh); var tw = w; w = ow * (h/oh); x += tw - w; break; case "west": var th = h; h = oh * (w/ow); h = Math.min(Math.max(mh, h), mxh); y += (th - h) / 2; var tw = w; w = ow * (h/oh); x += tw - w; break; case "northwest": var tw = w; var th = h; h = oh * (w/ow); h = Math.min(Math.max(mh, h), mxh); w = ow * (h/oh); y += th - h; x += tw - w; break; } } this.proxy.setBounds(x, y, w, h); if(this.dynamic){ this.resizeElement(); } }catch(e){} } }, handleOver : function(){ if(this.enabled){ this.el.addClass("x-resizable-over"); } }, handleOut : function(){ if(!this.resizing){ this.el.removeClass("x-resizable-over"); } }, getEl : function(){ return this.el; }, getResizeChild : function(){ return this.resizeChild; }, destroy : function(removeEl){ this.proxy.remove(); if(this.overlay){ this.overlay.removeAllListeners(); this.overlay.remove(); } var ps = Ext.Resizable.positions; for(var k in ps){ if(typeof ps[k] != "function" && this[ps[k]]){ var h = this[ps[k]]; h.el.removeAllListeners(); h.el.remove(); } } if(removeEl){ this.el.update(""); this.el.remove(); } }, syncHandleHeight : function(){ var h = this.el.getHeight(true); if(this.west){ this.west.el.setHeight(h); } if(this.east){ this.east.el.setHeight(h); } } }); Ext.Resizable.positions = { n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast" }; Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){ if(!this.tpl){ var tpl = Ext.DomHelper.createTemplate( {tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"} ); tpl.compile(); Ext.Resizable.Handle.prototype.tpl = tpl; } this.position = pos; this.rz = rz; this.el = this.tpl.append(rz.el.dom, [this.position], true); this.el.unselectable(); if(transparent){ this.el.setOpacity(0); } this.el.on("mousedown", this.onMouseDown, this); if(!disableTrackOver){ this.el.on("mouseover", this.onMouseOver, this); this.el.on("mouseout", this.onMouseOut, this); } }; Ext.Resizable.Handle.prototype = { afterResize : function(rz){ }, onMouseDown : function(e){ this.rz.onMouseDown(this, e); }, onMouseOver : function(e){ this.rz.handleOver(this, e); }, onMouseOut : function(e){ this.rz.handleOut(this, e); } }; Ext.Editor = function(field, config){ this.field = field; Ext.Editor.superclass.constructor.call(this, config); }; Ext.extend(Ext.Editor, Ext.Component, { value : "", alignment: "c-c?", shadow : "frame", constrain : false, swallowKeys : true, completeOnEnter : false, cancelOnEsc : false, updateEl : false, initComponent : function(){ Ext.Editor.superclass.initComponent.call(this); this.addEvents( "beforestartedit", "startedit", "beforecomplete", "complete", "specialkey" ); }, onRender : function(ct, position){ this.el = new Ext.Layer({ shadow: this.shadow, cls: "x-editor", parentEl : ct, shim : this.shim, shadowOffset:4, id: this.id, constrain: this.constrain }); this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden"); if(this.field.msgTarget != 'title'){ this.field.msgTarget = 'qtip'; } this.field.inEditor = true; this.field.render(this.el); if(Ext.isGecko){ this.field.el.dom.setAttribute('autocomplete', 'off'); } this.field.on("specialkey", this.onSpecialKey, this); if(this.swallowKeys){ this.field.el.swallowEvent(['keydown','keypress']); } this.field.show(); this.field.on("blur", this.onBlur, this); if(this.field.grow){ this.field.on("autosize", this.el.sync, this.el, {delay:1}); } }, onSpecialKey : function(field, e){ if(this.completeOnEnter && e.getKey() == e.ENTER){ e.stopEvent(); this.completeEdit(); }else if(this.cancelOnEsc && e.getKey() == e.ESC){ this.cancelEdit(); }else{ this.fireEvent('specialkey', field, e); } }, startEdit : function(el, value){ if(this.editing){ this.completeEdit(); } this.boundEl = Ext.get(el); var v = value !== undefined ? value : this.boundEl.dom.innerHTML; if(!this.rendered){ this.render(this.parentEl || document.body); } if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){ return; } this.startValue = v; this.field.setValue(v); this.doAutoSize(); this.el.alignTo(this.boundEl, this.alignment); this.editing = true; this.show(); }, doAutoSize : function(){ if(this.autoSize){ var sz = this.boundEl.getSize(); switch(this.autoSize){ case "width": this.setSize(sz.width, ""); break; case "height": this.setSize("", sz.height); break; default: this.setSize(sz.width, sz.height); } } }, setSize : function(w, h){ delete this.field.lastSize; this.field.setSize(w, h); if(this.el){ this.el.sync(); } }, realign : function(){ this.el.alignTo(this.boundEl, this.alignment); }, completeEdit : function(remainVisible){ if(!this.editing){ return; } var v = this.getValue(); if(this.revertInvalid !== false && !this.field.isValid()){ v = this.startValue; this.cancelEdit(true); } if(String(v) === String(this.startValue) && this.ignoreNoChange){ this.editing = false; this.hide(); return; } if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){ this.editing = false; if(this.updateEl && this.boundEl){ this.boundEl.update(v); } if(remainVisible !== true){ this.hide(); } this.fireEvent("complete", this, v, this.startValue); } }, onShow : function(){ this.el.show(); if(this.hideEl !== false){ this.boundEl.hide(); } this.field.show(); if(Ext.isIE && !this.fixIEFocus){ this.fixIEFocus = true; this.deferredFocus.defer(50, this); }else{ this.field.focus(); } this.fireEvent("startedit", this.boundEl, this.startValue); }, deferredFocus : function(){ if(this.editing){ this.field.focus(); } }, cancelEdit : function(remainVisible){ if(this.editing){ this.setValue(this.startValue); if(remainVisible !== true){ this.hide(); } } }, onBlur : function(){ if(this.allowBlur !== true && this.editing){ this.completeEdit(); } }, onHide : function(){ if(this.editing){ this.completeEdit(); return; } this.field.blur(); if(this.field.collapse){ this.field.collapse(); } this.el.hide(); if(this.hideEl !== false){ this.boundEl.show(); } }, setValue : function(v){ this.field.setValue(v); }, getValue : function(){ return this.field.getValue(); }, beforeDestroy : function(){ this.field.destroy(); this.field = null; } }); Ext.reg('editor', Ext.Editor); Ext.MessageBox = function(){ var dlg, opt, mask, waitTimer; var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl; var buttons, activeTextEl, bwidth, iconCls = ''; var handleButton = function(button){ dlg.hide(); Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value], 1); }; var handleHide = function(){ if(opt && opt.cls){ dlg.el.removeClass(opt.cls); } progressBar.reset(); }; var handleEsc = function(d, k, e){ if(opt && opt.closable !== false){ dlg.hide(); } if(e){ e.stopEvent(); } }; var updateButtons = function(b){ var width = 0; if(!b){ buttons["ok"].hide(); buttons["cancel"].hide(); buttons["yes"].hide(); buttons["no"].hide(); return width; } dlg.footer.dom.style.display = ''; for(var k in buttons){ if(typeof buttons[k] != "function"){ if(b[k]){ buttons[k].show(); buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]); width += buttons[k].el.getWidth()+15; }else{ buttons[k].hide(); } } } return width; }; return { getDialog : function(titleText){ if(!dlg){ dlg = new Ext.Window({ autoCreate : true, title:titleText, resizable:false, constrain:true, constrainHeader:true, minimizable : false, maximizable : false, stateful: false, modal: true, shim:true, buttonAlign:"center", width:400, height:100, minHeight: 80, plain:true, footer:true, closable:true, close : function(){ if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ handleButton("no"); }else{ handleButton("cancel"); } } }); buttons = {}; var bt = this.buttonText; buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok")); buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes")); buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no")); buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel")); buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets'; dlg.render(document.body); dlg.getEl().addClass('x-window-dlg'); mask = dlg.mask; bodyEl = dlg.body.createChild({ html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div>' }); iconEl = Ext.get(bodyEl.dom.firstChild); var contentEl = bodyEl.dom.childNodes[1]; msgEl = Ext.get(contentEl.firstChild); textboxEl = Ext.get(contentEl.childNodes[2]); textboxEl.enableDisplayMode(); textboxEl.addKeyListener([10,13], function(){ if(dlg.isVisible() && opt && opt.buttons){ if(opt.buttons.ok){ handleButton("ok"); }else if(opt.buttons.yes){ handleButton("yes"); } } }); textareaEl = Ext.get(contentEl.childNodes[3]); textareaEl.enableDisplayMode(); progressBar = new Ext.ProgressBar({ renderTo:bodyEl }); bodyEl.createChild({cls:'x-clear'}); } return dlg; }, updateText : function(text){ if(!dlg.isVisible() && !opt.width){ dlg.setSize(this.maxWidth, 100); } msgEl.update(text || '&#160;'); var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0; var mw = msgEl.getWidth() + msgEl.getMargins('lr'); var fw = dlg.getFrameWidth('lr'); var bw = dlg.body.getFrameWidth('lr'); if (Ext.isIE && iw > 0){ iw += 3; } var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth), Math.max(opt.minWidth || this.minWidth, bwidth || 0)); if(opt.prompt === true){ activeTextEl.setWidth(w-iw-fw-bw); } if(opt.progress === true || opt.wait === true){ progressBar.setSize(w-iw-fw-bw); } dlg.setSize(w, 'auto').center(); return this; }, updateProgress : function(value, progressText, msg){ progressBar.updateProgress(value, progressText); if(msg){ this.updateText(msg); } return this; }, isVisible : function(){ return dlg && dlg.isVisible(); }, hide : function(){ if(this.isVisible()){ dlg.hide(); handleHide(); } return this; }, show : function(options){ if(this.isVisible()){ this.hide(); } opt = options; var d = this.getDialog(opt.title || "&#160;"); d.setTitle(opt.title || "&#160;"); var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true); d.tools.close.setDisplayed(allowClose); activeTextEl = textboxEl; opt.prompt = opt.prompt || (opt.multiline ? true : false); if(opt.prompt){ if(opt.multiline){ textboxEl.hide(); textareaEl.show(); textareaEl.setHeight(typeof opt.multiline == "number" ? opt.multiline : this.defaultTextHeight); activeTextEl = textareaEl; }else{ textboxEl.show(); textareaEl.hide(); } }else{ textboxEl.hide(); textareaEl.hide(); } activeTextEl.dom.value = opt.value || ""; if(opt.prompt){ d.focusEl = activeTextEl; }else{ var bs = opt.buttons; var db = null; if(bs && bs.ok){ db = buttons["ok"]; }else if(bs && bs.yes){ db = buttons["yes"]; } if (db){ d.focusEl = db; } } this.setIcon(opt.icon); bwidth = updateButtons(opt.buttons); progressBar.setVisible(opt.progress === true || opt.wait === true); this.updateProgress(0, opt.progressText); this.updateText(opt.msg); if(opt.cls){ d.el.addClass(opt.cls); } d.proxyDrag = opt.proxyDrag === true; d.modal = opt.modal !== false; d.mask = opt.modal !== false ? mask : false; if(!d.isVisible()){ document.body.appendChild(dlg.el.dom); d.setAnimateTarget(opt.animEl); d.show(opt.animEl); } d.on('show', function(){ if(allowClose === true){ d.keyMap.enable(); }else{ d.keyMap.disable(); } }, this, {single:true}); if(opt.wait === true){ progressBar.wait(opt.waitConfig); } return this; }, setIcon : function(icon){ if(icon && icon != ''){ iconEl.removeClass('x-hidden'); iconEl.replaceClass(iconCls, icon); iconCls = icon; }else{ iconEl.replaceClass(iconCls, 'x-hidden'); iconCls = ''; } return this; }, progress : function(title, msg, progressText){ this.show({ title : title, msg : msg, buttons: false, progress:true, closable:false, minWidth: this.minProgressWidth, progressText: progressText }); return this; }, wait : function(msg, title, config){ this.show({ title : title, msg : msg, buttons: false, closable:false, wait:true, modal:true, minWidth: this.minProgressWidth, waitConfig: config }); return this; }, alert : function(title, msg, fn, scope){ this.show({ title : title, msg : msg, buttons: this.OK, fn: fn, scope : scope }); return this; }, confirm : function(title, msg, fn, scope){ this.show({ title : title, msg : msg, buttons: this.YESNO, fn: fn, scope : scope, icon: this.QUESTION }); return this; }, prompt : function(title, msg, fn, scope, multiline){ this.show({ title : title, msg : msg, buttons: this.OKCANCEL, fn: fn, minWidth:250, scope : scope, prompt:true, multiline: multiline }); return this; }, OK : {ok:true}, CANCEL : {cancel:true}, OKCANCEL : {ok:true, cancel:true}, YESNO : {yes:true, no:true}, YESNOCANCEL : {yes:true, no:true, cancel:true}, INFO : 'ext-mb-info', WARNING : 'ext-mb-warning', QUESTION : 'ext-mb-question', ERROR : 'ext-mb-error', defaultTextHeight : 75, maxWidth : 600, minWidth : 100, minProgressWidth : 250, buttonText : { ok : "OK", cancel : "Cancel", yes : "Yes", no : "No" } }; }(); Ext.Msg = Ext.MessageBox; Ext.Tip = Ext.extend(Ext.Panel, { minWidth : 40, maxWidth : 300, shadow : "sides", defaultAlign : "tl-bl?", autoRender: true, quickShowInterval : 250, frame:true, hidden:true, baseCls: 'x-tip', floating:{shadow:true,shim:true,useDisplay:true,constrain:false}, autoHeight:true, initComponent : function(){ Ext.Tip.superclass.initComponent.call(this); if(this.closable && !this.title){ this.elements += ',header'; } }, afterRender : function(){ Ext.Tip.superclass.afterRender.call(this); if(this.closable){ this.addTool({ id: 'close', handler: this.hide, scope: this }); } }, showAt : function(xy){ Ext.Tip.superclass.show.call(this); if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){ var bw = this.body.getTextWidth(); if(this.title){ bw = Math.max(bw, this.header.child('span').getTextWidth(this.title)); } bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr"); this.setWidth(bw.constrain(this.minWidth, this.maxWidth)); } if(this.constrainPosition){ xy = this.el.adjustForConstraints(xy); } this.setPagePosition(xy[0], xy[1]); }, showBy : function(el, pos){ if(!this.rendered){ this.render(Ext.getBody()); } this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign)); }, initDraggable : function(){ this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable); this.header.addClass('x-tip-draggable'); } }); Ext.Tip.DD = function(tip, config){ Ext.apply(this, config); this.tip = tip; Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id); this.setHandleElId(tip.header.id); this.scroll = false; }; Ext.extend(Ext.Tip.DD, Ext.dd.DD, { moveOnly:true, scroll:false, headerOffsets:[100, 25], startDrag : function(){ this.tip.el.disableShadow(); }, endDrag : function(e){ this.tip.el.enableShadow(true); } }); Ext.ToolTip = Ext.extend(Ext.Tip, { showDelay: 500, hideDelay: 200, dismissDelay: 5000, mouseOffset: [15,18], trackMouse : false, constrainPosition: true, initComponent: function(){ Ext.ToolTip.superclass.initComponent.call(this); this.lastActive = new Date(); this.initTarget(); }, initTarget : function(){ if(this.target){ this.target = Ext.get(this.target); this.target.on('mouseover', this.onTargetOver, this); this.target.on('mouseout', this.onTargetOut, this); this.target.on('mousemove', this.onMouseMove, this); } }, onMouseMove : function(e){ this.targetXY = e.getXY(); if(!this.hidden && this.trackMouse){ this.setPagePosition(this.getTargetXY()); } }, getTargetXY : function(){ return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]]; }, onTargetOver : function(e){ if(this.disabled || e.within(this.target.dom, true)){ return; } this.clearTimer('hide'); this.targetXY = e.getXY(); this.delayShow(); }, delayShow : function(){ if(this.hidden && !this.showTimer){ if(this.lastActive.getElapsed() < this.quickShowInterval){ this.show(); }else{ this.showTimer = this.show.defer(this.showDelay, this); } }else if(!this.hidden && this.autoHide !== false){ this.show(); } }, onTargetOut : function(e){ if(this.disabled || e.within(this.target.dom, true)){ return; } this.clearTimer('show'); if(this.autoHide !== false){ this.delayHide(); } }, delayHide : function(){ if(!this.hidden && !this.hideTimer){ this.hideTimer = this.hide.defer(this.hideDelay, this); } }, hide: function(){ this.clearTimer('dismiss'); this.lastActive = new Date(); Ext.ToolTip.superclass.hide.call(this); }, show : function(){ this.showAt(this.getTargetXY()); }, showAt : function(xy){ this.lastActive = new Date(); this.clearTimers(); Ext.ToolTip.superclass.showAt.call(this, xy); if(this.dismissDelay && this.autoHide !== false){ this.dismissTimer = this.hide.defer(this.dismissDelay, this); } }, clearTimer : function(name){ name = name + 'Timer'; clearTimeout(this[name]); delete this[name]; }, clearTimers : function(){ this.clearTimer('show'); this.clearTimer('dismiss'); this.clearTimer('hide'); }, onShow : function(){ Ext.ToolTip.superclass.onShow.call(this); Ext.getDoc().on('mousedown', this.onDocMouseDown, this); }, onHide : function(){ Ext.ToolTip.superclass.onHide.call(this); Ext.getDoc().un('mousedown', this.onDocMouseDown, this); }, onDocMouseDown : function(e){ if(this.autoHide !== false && !e.within(this.el.dom)){ this.disable(); this.enable.defer(100, this); } }, onDisable : function(){ this.clearTimers(); this.hide(); }, adjustPosition : function(x, y){ var ay = this.targetXY[1], h = this.getSize().height; if(this.constrainPosition && y <= ay && (y+h) >= ay){ y = ay-h-5; } return {x : x, y: y}; }, onDestroy : function(){ Ext.ToolTip.superclass.onDestroy.call(this); if(this.target){ this.target.un('mouseover', this.onTargetOver, this); this.target.un('mouseout', this.onTargetOut, this); this.target.un('mousemove', this.onMouseMove, this); } } }); Ext.QuickTip = Ext.extend(Ext.ToolTip, { interceptTitles : false, tagConfig : { namespace : "ext", attribute : "qtip", width : "qwidth", target : "target", title : "qtitle", hide : "hide", cls : "qclass", align : "qalign" }, initComponent : function(){ this.target = this.target || Ext.getDoc(); this.targets = this.targets || {}; Ext.QuickTip.superclass.initComponent.call(this); }, register : function(config){ var cs = Ext.isArray(config) ? config : arguments; for(var i = 0, len = cs.length; i < len; i++){ var c = cs[i]; var target = c.target; if(target){ if(Ext.isArray(target)){ for(var j = 0, jlen = target.length; j < jlen; j++){ this.targets[Ext.id(target[j])] = c; } } else{ this.targets[Ext.id(target)] = c; } } } }, unregister : function(el){ delete this.targets[Ext.id(el)]; }, onTargetOver : function(e){ if(this.disabled){ return; } this.targetXY = e.getXY(); var t = e.getTarget(); if(!t || t.nodeType !== 1 || t == document || t == document.body){ return; } if(this.activeTarget && t == this.activeTarget.el){ this.clearTimer('hide'); this.show(); return; } if(t && this.targets[t.id]){ this.activeTarget = this.targets[t.id]; this.activeTarget.el = t; this.delayShow(); return; } var ttp, et = Ext.fly(t), cfg = this.tagConfig; var ns = cfg.namespace; if(this.interceptTitles && t.title){ ttp = t.title; t.qtip = ttp; t.removeAttribute("title"); e.preventDefault(); } else{ ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute); } if(ttp){ var autoHide = et.getAttributeNS(ns, cfg.hide); this.activeTarget = { el: t, text: ttp, width: et.getAttributeNS(ns, cfg.width), autoHide: autoHide != "user" && autoHide !== 'false', title: et.getAttributeNS(ns, cfg.title), cls: et.getAttributeNS(ns, cfg.cls), align: et.getAttributeNS(ns, cfg.align) }; this.delayShow(); } }, onTargetOut : function(e){ this.clearTimer('show'); if(this.autoHide !== false){ this.delayHide(); } }, showAt : function(xy){ var t = this.activeTarget; if(t){ if(!this.rendered){ this.render(Ext.getBody()); this.activeTarget = t; } if(t.width){ this.setWidth(t.width); this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth())); this.measureWidth = false; } else{ this.measureWidth = true; } this.setTitle(t.title || ''); this.body.update(t.text); this.autoHide = t.autoHide; this.dismissDelay = t.dismissDelay || this.dismissDelay; if(this.lastCls){ this.el.removeClass(this.lastCls); delete this.lastCls; } if(t.cls){ this.el.addClass(t.cls); this.lastCls = t.cls; } if(t.align){ xy = this.el.getAlignToXY(t.el, t.align); this.constrainPosition = false; } else{ this.constrainPosition = true; } } Ext.QuickTip.superclass.showAt.call(this, xy); }, hide: function(){ delete this.activeTarget; Ext.QuickTip.superclass.hide.call(this); } }); Ext.QuickTips = function(){ var tip, locks = []; return { init : function(){ if(!tip){ tip = new Ext.QuickTip({elements:'header,body'}); } }, enable : function(){ if(tip){ locks.pop(); if(locks.length < 1){ tip.enable(); } } }, disable : function(){ if(tip){ tip.disable(); } locks.push(1); }, isEnabled : function(){ return tip && !tip.disabled; }, getQuickTip : function(){ return tip; }, register : function(){ tip.register.apply(tip, arguments); }, unregister : function(){ tip.unregister.apply(tip, arguments); }, tips :function(){ tip.register.apply(tip, arguments); } } }(); Ext.tree.TreePanel = Ext.extend(Ext.Panel, { rootVisible : true, animate: Ext.enableFx, lines : true, enableDD : false, hlDrop : Ext.enableFx, pathSeparator: "/", initComponent : function(){ Ext.tree.TreePanel.superclass.initComponent.call(this); if(!this.eventModel){ this.eventModel = new Ext.tree.TreeEventModel(this); } this.nodeHash = {}; if(this.root){ this.setRootNode(this.root); } this.addEvents( "append", "remove", "movenode", "insert", "beforeappend", "beforeremove", "beforemovenode", "beforeinsert", "beforeload", "load", "textchange", "beforeexpandnode", "beforecollapsenode", "expandnode", "disabledchange", "collapsenode", "beforeclick", "click", "checkchange", "dblclick", "contextmenu", "beforechildrenrendered", "startdrag", "enddrag", "dragdrop", "beforenodedrop", "nodedrop", "nodedragover" ); if(this.singleExpand){ this.on("beforeexpandnode", this.restrictExpand, this); } }, proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){ if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){ ename = ename+'node'; } return this.fireEvent(ename, a1, a2, a3, a4, a5, a6); }, getRootNode : function(){ return this.root; }, setRootNode : function(node){ this.root = node; node.ownerTree = this; node.isRoot = true; this.registerNode(node); if(!this.rootVisible){ var uiP = node.attributes.uiProvider; node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node); } return node; }, getNodeById : function(id){ return this.nodeHash[id]; }, registerNode : function(node){ this.nodeHash[node.id] = node; }, unregisterNode : function(node){ delete this.nodeHash[node.id]; }, toString : function(){ return "[Tree"+(this.id?" "+this.id:"")+"]"; }, restrictExpand : function(node){ var p = node.parentNode; if(p){ if(p.expandedChild && p.expandedChild.parentNode == p){ p.expandedChild.collapse(); } p.expandedChild = node; } }, getChecked : function(a, startNode){ startNode = startNode || this.root; var r = []; var f = function(){ if(this.attributes.checked){ r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a])); } } startNode.cascade(f); return r; }, getEl : function(){ return this.el; }, getLoader : function(){ return this.loader; }, expandAll : function(){ this.root.expand(true); }, collapseAll : function(){ this.root.collapse(true); }, getSelectionModel : function(){ if(!this.selModel){ this.selModel = new Ext.tree.DefaultSelectionModel(); } return this.selModel; }, expandPath : function(path, attr, callback){ attr = attr || "id"; var keys = path.split(this.pathSeparator); var curNode = this.root; if(curNode.attributes[attr] != keys[1]){ if(callback){ callback(false, null); } return; } var index = 1; var f = function(){ if(++index == keys.length){ if(callback){ callback(true, curNode); } return; } var c = curNode.findChild(attr, keys[index]); if(!c){ if(callback){ callback(false, curNode); } return; } curNode = c; c.expand(false, false, f); }; curNode.expand(false, false, f); }, selectPath : function(path, attr, callback){ attr = attr || "id"; var keys = path.split(this.pathSeparator); var v = keys.pop(); if(keys.length > 0){ var f = function(success, node){ if(success && node){ var n = node.findChild(attr, v); if(n){ n.select(); if(callback){ callback(true, n); } }else if(callback){ callback(false, n); } }else{ if(callback){ callback(false, n); } } }; this.expandPath(keys.join(this.pathSeparator), attr, f); }else{ this.root.select(); if(callback){ callback(true, this.root); } } }, getTreeEl : function(){ return this.body; }, onRender : function(ct, position){ Ext.tree.TreePanel.superclass.onRender.call(this, ct, position); this.el.addClass('x-tree'); this.innerCt = this.body.createChild({tag:"ul", cls:"x-tree-root-ct " + (this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")}); }, initEvents : function(){ Ext.tree.TreePanel.superclass.initEvents.call(this); if(this.containerScroll){ Ext.dd.ScrollManager.register(this.body); } if((this.enableDD || this.enableDrop) && !this.dropZone){ this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || { ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true }); } if((this.enableDD || this.enableDrag) && !this.dragZone){ this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || { ddGroup: this.ddGroup || "TreeDD", scroll: this.ddScroll }); } this.getSelectionModel().init(this); }, afterRender : function(){ Ext.tree.TreePanel.superclass.afterRender.call(this); this.root.render(); if(!this.rootVisible){ this.root.renderChildren(); } }, onDestroy : function(){ if(this.rendered){ this.body.removeAllListeners(); Ext.dd.ScrollManager.unregister(this.body); if(this.dropZone){ this.dropZone.unreg(); } if(this.dragZone){ this.dragZone.unreg(); } } this.root.destroy(); this.nodeHash = null; Ext.tree.TreePanel.superclass.onDestroy.call(this); } }); Ext.reg('treepanel', Ext.tree.TreePanel); Ext.tree.TreeEventModel = function(tree){ this.tree = tree; this.tree.on('render', this.initEvents, this); } Ext.tree.TreeEventModel.prototype = { initEvents : function(){ var el = this.tree.getTreeEl(); el.on('click', this.delegateClick, this); if(this.tree.trackMouseOver !== false){ el.on('mouseover', this.delegateOver, this); el.on('mouseout', this.delegateOut, this); } el.on('dblclick', this.delegateDblClick, this); el.on('contextmenu', this.delegateContextMenu, this); }, getNode : function(e){ var t; if(t = e.getTarget('.x-tree-node-el', 10)){ var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id'); if(id){ return this.tree.getNodeById(id); } } return null; }, getNodeTarget : function(e){ var t = e.getTarget('.x-tree-node-icon', 1); if(!t){ t = e.getTarget('.x-tree-node-el', 6); } return t; }, delegateOut : function(e, t){ if(!this.beforeEvent(e)){ return; } if(e.getTarget('.x-tree-ec-icon', 1)){ var n = this.getNode(e); this.onIconOut(e, n); if(n == this.lastEcOver){ delete this.lastEcOver; } } if((t = this.getNodeTarget(e)) && !e.within(t, true)){ this.onNodeOut(e, this.getNode(e)); } }, delegateOver : function(e, t){ if(!this.beforeEvent(e)){ return; } if(this.lastEcOver){ this.onIconOut(e, this.lastEcOver); delete this.lastEcOver; } if(e.getTarget('.x-tree-ec-icon', 1)){ this.lastEcOver = this.getNode(e); this.onIconOver(e, this.lastEcOver); } if(t = this.getNodeTarget(e)){ this.onNodeOver(e, this.getNode(e)); } }, delegateClick : function(e, t){ if(!this.beforeEvent(e)){ return; } if(e.getTarget('input[type=checkbox]', 1)){ this.onCheckboxClick(e, this.getNode(e)); } else if(e.getTarget('.x-tree-ec-icon', 1)){ this.onIconClick(e, this.getNode(e)); } else if(this.getNodeTarget(e)){ this.onNodeClick(e, this.getNode(e)); } }, delegateDblClick : function(e, t){ if(this.beforeEvent(e) && this.getNodeTarget(e)){ this.onNodeDblClick(e, this.getNode(e)); } }, delegateContextMenu : function(e, t){ if(this.beforeEvent(e) && this.getNodeTarget(e)){ this.onNodeContextMenu(e, this.getNode(e)); } }, onNodeClick : function(e, node){ node.ui.onClick(e); }, onNodeOver : function(e, node){ node.ui.onOver(e); }, onNodeOut : function(e, node){ node.ui.onOut(e); }, onIconOver : function(e, node){ node.ui.addClass('x-tree-ec-over'); }, onIconOut : function(e, node){ node.ui.removeClass('x-tree-ec-over'); }, onIconClick : function(e, node){ node.ui.ecClick(e); }, onCheckboxClick : function(e, node){ node.ui.onCheckChange(e); }, onNodeDblClick : function(e, node){ node.ui.onDblClick(e); }, onNodeContextMenu : function(e, node){ node.ui.onContextMenu(e); }, beforeEvent : function(e){ if(this.disabled){ e.stopEvent(); return false; } return true; }, disable: function(){ this.disabled = true; }, enable: function(){ this.disabled = false; } }; Ext.tree.DefaultSelectionModel = function(config){ this.selNode = null; this.addEvents( "selectionchange", "beforeselect" ); Ext.apply(this, config); Ext.tree.DefaultSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, { init : function(tree){ this.tree = tree; tree.getTreeEl().on("keydown", this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, onNodeClick : function(node, e){ this.select(node); }, select : function(node){ var last = this.selNode; if(last != node && this.fireEvent('beforeselect', this, node, last) !== false){ if(last){ last.ui.onSelectedChange(false); } this.selNode = node; node.ui.onSelectedChange(true); this.fireEvent("selectionchange", this, node, last); } return node; }, unselect : function(node){ if(this.selNode == node){ this.clearSelections(); } }, clearSelections : function(){ var n = this.selNode; if(n){ n.ui.onSelectedChange(false); this.selNode = null; this.fireEvent("selectionchange", this, null); } return n; }, getSelectedNode : function(){ return this.selNode; }, isSelected : function(node){ return this.selNode == node; }, selectPrevious : function(){ var s = this.selNode || this.lastSelNode; if(!s){ return null; } var ps = s.previousSibling; if(ps){ if(!ps.isExpanded() || ps.childNodes.length < 1){ return this.select(ps); } else{ var lc = ps.lastChild; while(lc && lc.isExpanded() && lc.childNodes.length > 0){ lc = lc.lastChild; } return this.select(lc); } } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){ return this.select(s.parentNode); } return null; }, selectNext : function(){ var s = this.selNode || this.lastSelNode; if(!s){ return null; } if(s.firstChild && s.isExpanded()){ return this.select(s.firstChild); }else if(s.nextSibling){ return this.select(s.nextSibling); }else if(s.parentNode){ var newS = null; s.parentNode.bubble(function(){ if(this.nextSibling){ newS = this.getOwnerTree().selModel.select(this.nextSibling); return false; } }); return newS; } return null; }, onKeyDown : function(e){ var s = this.selNode || this.lastSelNode; var sm = this; if(!s){ return; } var k = e.getKey(); switch(k){ case e.DOWN: e.stopEvent(); this.selectNext(); break; case e.UP: e.stopEvent(); this.selectPrevious(); break; case e.RIGHT: e.preventDefault(); if(s.hasChildNodes()){ if(!s.isExpanded()){ s.expand(); }else if(s.firstChild){ this.select(s.firstChild, e); } } break; case e.LEFT: e.preventDefault(); if(s.hasChildNodes() && s.isExpanded()){ s.collapse(); }else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){ this.select(s.parentNode, e); } break; }; } }); Ext.tree.MultiSelectionModel = function(config){ this.selNodes = []; this.selMap = {}; this.addEvents( "selectionchange" ); Ext.apply(this, config); Ext.tree.MultiSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, { init : function(tree){ this.tree = tree; tree.getTreeEl().on("keydown", this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, onNodeClick : function(node, e){ this.select(node, e, e.ctrlKey); }, select : function(node, e, keepExisting){ if(keepExisting !== true){ this.clearSelections(true); } if(this.isSelected(node)){ this.lastSelNode = node; return node; } this.selNodes.push(node); this.selMap[node.id] = node; this.lastSelNode = node; node.ui.onSelectedChange(true); this.fireEvent("selectionchange", this, this.selNodes); return node; }, unselect : function(node){ if(this.selMap[node.id]){ node.ui.onSelectedChange(false); var sn = this.selNodes; var index = sn.indexOf(node); if(index != -1){ this.selNodes.splice(index, 1); } delete this.selMap[node.id]; this.fireEvent("selectionchange", this, this.selNodes); } }, clearSelections : function(suppressEvent){ var sn = this.selNodes; if(sn.length > 0){ for(var i = 0, len = sn.length; i < len; i++){ sn[i].ui.onSelectedChange(false); } this.selNodes = []; this.selMap = {}; if(suppressEvent !== true){ this.fireEvent("selectionchange", this, this.selNodes); } } }, isSelected : function(node){ return this.selMap[node.id] ? true : false; }, getSelectedNodes : function(){ return this.selNodes; }, onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown, selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext, selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious }); Ext.tree.TreeNode = function(attributes){ attributes = attributes || {}; if(typeof attributes == "string"){ attributes = {text: attributes}; } this.childrenRendered = false; this.rendered = false; Ext.tree.TreeNode.superclass.constructor.call(this, attributes); this.expanded = attributes.expanded === true; this.isTarget = attributes.isTarget !== false; this.draggable = attributes.draggable !== false && attributes.allowDrag !== false; this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false; this.text = attributes.text; this.disabled = attributes.disabled === true; this.addEvents( "textchange", "beforeexpand", "beforecollapse", "expand", "disabledchange", "collapse", "beforeclick", "click", "checkchange", "dblclick", "contextmenu", "beforechildrenrendered" ); var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI; this.ui = new uiClass(this); }; Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { preventHScroll: true, isExpanded : function(){ return this.expanded; }, getUI : function(){ return this.ui; }, setFirstChild : function(node){ var of = this.firstChild; Ext.tree.TreeNode.superclass.setFirstChild.call(this, node); if(this.childrenRendered && of && node != of){ of.renderIndent(true, true); } if(this.rendered){ this.renderIndent(true, true); } }, setLastChild : function(node){ var ol = this.lastChild; Ext.tree.TreeNode.superclass.setLastChild.call(this, node); if(this.childrenRendered && ol && node != ol){ ol.renderIndent(true, true); } if(this.rendered){ this.renderIndent(true, true); } }, appendChild : function(){ var node = Ext.tree.TreeNode.superclass.appendChild.apply(this, arguments); if(node && this.childrenRendered){ node.render(); } this.ui.updateExpandIcon(); return node; }, removeChild : function(node){ this.ownerTree.getSelectionModel().unselect(node); Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments); if(this.childrenRendered){ node.ui.remove(); } if(this.childNodes.length < 1){ this.collapse(false, false); }else{ this.ui.updateExpandIcon(); } if(!this.firstChild && !this.isHiddenRoot()) { this.childrenRendered = false; } return node; }, insertBefore : function(node, refNode){ var newNode = Ext.tree.TreeNode.superclass.insertBefore.apply(this, arguments); if(newNode && refNode && this.childrenRendered){ node.render(); } this.ui.updateExpandIcon(); return newNode; }, setText : function(text){ var oldText = this.text; this.text = text; this.attributes.text = text; if(this.rendered){ this.ui.onTextChange(this, text, oldText); } this.fireEvent("textchange", this, text, oldText); }, select : function(){ this.getOwnerTree().getSelectionModel().select(this); }, unselect : function(){ this.getOwnerTree().getSelectionModel().unselect(this); }, isSelected : function(){ return this.getOwnerTree().getSelectionModel().isSelected(this); }, expand : function(deep, anim, callback){ if(!this.expanded){ if(this.fireEvent("beforeexpand", this, deep, anim) === false){ return; } if(!this.childrenRendered){ this.renderChildren(); } this.expanded = true; if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){ this.ui.animExpand(function(){ this.fireEvent("expand", this); if(typeof callback == "function"){ callback(this); } if(deep === true){ this.expandChildNodes(true); } }.createDelegate(this)); return; }else{ this.ui.expand(); this.fireEvent("expand", this); if(typeof callback == "function"){ callback(this); } } }else{ if(typeof callback == "function"){ callback(this); } } if(deep === true){ this.expandChildNodes(true); } }, isHiddenRoot : function(){ return this.isRoot && !this.getOwnerTree().rootVisible; }, collapse : function(deep, anim){ if(this.expanded && !this.isHiddenRoot()){ if(this.fireEvent("beforecollapse", this, deep, anim) === false){ return; } this.expanded = false; if((this.getOwnerTree().animate && anim !== false) || anim){ this.ui.animCollapse(function(){ this.fireEvent("collapse", this); if(deep === true){ this.collapseChildNodes(true); } }.createDelegate(this)); return; }else{ this.ui.collapse(); this.fireEvent("collapse", this); } } if(deep === true){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { cs[i].collapse(true, false); } } }, delayedExpand : function(delay){ if(!this.expandProcId){ this.expandProcId = this.expand.defer(delay, this); } }, cancelExpand : function(){ if(this.expandProcId){ clearTimeout(this.expandProcId); } this.expandProcId = false; }, toggle : function(){ if(this.expanded){ this.collapse(); }else{ this.expand(); } }, ensureVisible : function(callback){ var tree = this.getOwnerTree(); tree.expandPath(this.parentNode.getPath(), false, function(){ var node = tree.getNodeById(this.id); tree.getTreeEl().scrollChildIntoView(node.ui.anchor); Ext.callback(callback); }.createDelegate(this)); }, expandChildNodes : function(deep){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { cs[i].expand(deep); } }, collapseChildNodes : function(deep){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++) { cs[i].collapse(deep); } }, disable : function(){ this.disabled = true; this.unselect(); if(this.rendered && this.ui.onDisableChange){ this.ui.onDisableChange(this, true); } this.fireEvent("disabledchange", this, true); }, enable : function(){ this.disabled = false; if(this.rendered && this.ui.onDisableChange){ this.ui.onDisableChange(this, false); } this.fireEvent("disabledchange", this, false); }, renderChildren : function(suppressEvent){ if(suppressEvent !== false){ this.fireEvent("beforechildrenrendered", this); } var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++){ cs[i].render(true); } this.childrenRendered = true; }, sort : function(fn, scope){ Ext.tree.TreeNode.superclass.sort.apply(this, arguments); if(this.childrenRendered){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++){ cs[i].render(true); } } }, render : function(bulkRender){ this.ui.render(bulkRender); if(!this.rendered){ this.getOwnerTree().registerNode(this); this.rendered = true; if(this.expanded){ this.expanded = false; this.expand(false, false); } } }, renderIndent : function(deep, refresh){ if(refresh){ this.ui.childIndent = null; } this.ui.renderIndent(); if(deep === true && this.childrenRendered){ var cs = this.childNodes; for(var i = 0, len = cs.length; i < len; i++){ cs[i].renderIndent(true, refresh); } } }, beginUpdate : function(){ this.childrenRendered = false; }, endUpdate : function(){ if(this.expanded){ this.renderChildren(); } }, destroy : function(){ for(var i = 0,l = this.childNodes.length; i < l; i++){ this.childNodes[i].destroy(); } this.childNodes = null; if(this.ui.destroy){ this.ui.destroy(); } } }); Ext.tree.AsyncTreeNode = function(config){ this.loaded = false; this.loading = false; Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments); this.addEvents('beforeload', 'load'); }; Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, { expand : function(deep, anim, callback){ if(this.loading){ var timer; var f = function(){ if(!this.loading){ clearInterval(timer); this.expand(deep, anim, callback); } }.createDelegate(this); timer = setInterval(f, 200); return; } if(!this.loaded){ if(this.fireEvent("beforeload", this) === false){ return; } this.loading = true; this.ui.beforeLoad(this); var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader(); if(loader){ loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback])); return; } } Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback); }, isLoading : function(){ return this.loading; }, loadComplete : function(deep, anim, callback){ this.loading = false; this.loaded = true; this.ui.afterLoad(this); this.fireEvent("load", this); this.expand(deep, anim, callback); }, isLoaded : function(){ return this.loaded; }, hasChildNodes : function(){ if(!this.isLeaf() && !this.loaded){ return true; }else{ return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this); } }, reload : function(callback){ this.collapse(false, false); while(this.firstChild){ this.removeChild(this.firstChild); } this.childrenRendered = false; this.loaded = false; if(this.isHiddenRoot()){ this.expanded = false; } this.expand(false, false, callback); } }); Ext.tree.TreeNodeUI = function(node){ this.node = node; this.rendered = false; this.animating = false; this.wasLeaf = true; this.ecc = 'x-tree-ec-icon x-tree-elbow'; this.emptyIcon = Ext.BLANK_IMAGE_URL; }; Ext.tree.TreeNodeUI.prototype = { removeChild : function(node){ if(this.rendered){ this.ctNode.removeChild(node.ui.getEl()); } }, beforeLoad : function(){ this.addClass("x-tree-node-loading"); }, afterLoad : function(){ this.removeClass("x-tree-node-loading"); }, onTextChange : function(node, text, oldText){ if(this.rendered){ this.textNode.innerHTML = text; } }, onDisableChange : function(node, state){ this.disabled = state; if (this.checkbox) { this.checkbox.disabled = state; } if(state){ this.addClass("x-tree-node-disabled"); }else{ this.removeClass("x-tree-node-disabled"); } }, onSelectedChange : function(state){ if(state){ this.focus(); this.addClass("x-tree-selected"); }else{ this.removeClass("x-tree-selected"); } }, onMove : function(tree, node, oldParent, newParent, index, refNode){ this.childIndent = null; if(this.rendered){ var targetNode = newParent.ui.getContainer(); if(!targetNode){ this.holder = document.createElement("div"); this.holder.appendChild(this.wrap); return; } var insertBefore = refNode ? refNode.ui.getEl() : null; if(insertBefore){ targetNode.insertBefore(this.wrap, insertBefore); }else{ targetNode.appendChild(this.wrap); } this.node.renderIndent(true); } }, addClass : function(cls){ if(this.elNode){ Ext.fly(this.elNode).addClass(cls); } }, removeClass : function(cls){ if(this.elNode){ Ext.fly(this.elNode).removeClass(cls); } }, remove : function(){ if(this.rendered){ this.holder = document.createElement("div"); this.holder.appendChild(this.wrap); } }, fireEvent : function(){ return this.node.fireEvent.apply(this.node, arguments); }, initEvents : function(){ this.node.on("move", this.onMove, this); if(this.node.disabled){ this.addClass("x-tree-node-disabled"); if (this.checkbox) { this.checkbox.disabled = true; } } if(this.node.hidden){ this.hide(); } var ot = this.node.getOwnerTree(); var dd = ot.enableDD || ot.enableDrag || ot.enableDrop; if(dd && (!this.node.isRoot || ot.rootVisible)){ Ext.dd.Registry.register(this.elNode, { node: this.node, handles: this.getDDHandles(), isHandle: false }); } }, getDDHandles : function(){ return [this.iconNode, this.textNode, this.elNode]; }, hide : function(){ this.node.hidden = true; if(this.wrap){ this.wrap.style.display = "none"; } }, show : function(){ this.node.hidden = false; if(this.wrap){ this.wrap.style.display = ""; } }, onContextMenu : function(e){ if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) { e.preventDefault(); this.focus(); this.fireEvent("contextmenu", this.node, e); } }, onClick : function(e){ if(this.dropping){ e.stopEvent(); return; } if(this.fireEvent("beforeclick", this.node, e) !== false){ var a = e.getTarget('a'); if(!this.disabled && this.node.attributes.href && a){ this.fireEvent("click", this.node, e); return; }else if(a && e.ctrlKey){ e.stopEvent(); } e.preventDefault(); if(this.disabled){ return; } if(this.node.attributes.singleClickExpand && !this.animating && this.node.hasChildNodes()){ this.node.toggle(); } this.fireEvent("click", this.node, e); }else{ e.stopEvent(); } }, onDblClick : function(e){ e.preventDefault(); if(this.disabled){ return; } if(this.checkbox){ this.toggleCheck(); } if(!this.animating && this.node.hasChildNodes()){ this.node.toggle(); } this.fireEvent("dblclick", this.node, e); }, onOver : function(e){ this.addClass('x-tree-node-over'); }, onOut : function(e){ this.removeClass('x-tree-node-over'); }, onCheckChange : function(){ var checked = this.checkbox.checked; this.node.attributes.checked = checked; this.fireEvent('checkchange', this.node, checked); }, ecClick : function(e){ if(!this.animating && (this.node.hasChildNodes() || this.node.attributes.expandable)){ this.node.toggle(); } }, startDrop : function(){ this.dropping = true; }, endDrop : function(){ setTimeout(function(){ this.dropping = false; }.createDelegate(this), 50); }, expand : function(){ this.updateExpandIcon(); this.ctNode.style.display = ""; }, focus : function(){ if(!this.node.preventHScroll){ try{this.anchor.focus(); }catch(e){} }else if(!Ext.isIE){ try{ var noscroll = this.node.getOwnerTree().getTreeEl().dom; var l = noscroll.scrollLeft; this.anchor.focus(); noscroll.scrollLeft = l; }catch(e){} } }, toggleCheck : function(value){ var cb = this.checkbox; if(cb){ cb.checked = (value === undefined ? !cb.checked : value); } }, blur : function(){ try{ this.anchor.blur(); }catch(e){} }, animExpand : function(callback){ var ct = Ext.get(this.ctNode); ct.stopFx(); if(!this.node.hasChildNodes()){ this.updateExpandIcon(); this.ctNode.style.display = ""; Ext.callback(callback); return; } this.animating = true; this.updateExpandIcon(); ct.slideIn('t', { callback : function(){ this.animating = false; Ext.callback(callback); }, scope: this, duration: this.node.ownerTree.duration || .25 }); }, highlight : function(){ var tree = this.node.getOwnerTree(); Ext.fly(this.wrap).highlight( tree.hlColor || "C3DAF9", {endColor: tree.hlBaseColor} ); }, collapse : function(){ this.updateExpandIcon(); this.ctNode.style.display = "none"; }, animCollapse : function(callback){ var ct = Ext.get(this.ctNode); ct.enableDisplayMode('block'); ct.stopFx(); this.animating = true; this.updateExpandIcon(); ct.slideOut('t', { callback : function(){ this.animating = false; Ext.callback(callback); }, scope: this, duration: this.node.ownerTree.duration || .25 }); }, getContainer : function(){ return this.ctNode; }, getEl : function(){ return this.wrap; }, appendDDGhost : function(ghostNode){ ghostNode.appendChild(this.elNode.cloneNode(true)); }, getDDRepairXY : function(){ return Ext.lib.Dom.getXY(this.iconNode); }, onRender : function(){ this.render(); }, render : function(bulkRender){ var n = this.node, a = n.attributes; var targetNode = n.parentNode ? n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom; if(!this.rendered){ this.rendered = true; this.renderElements(n, a, targetNode, bulkRender); if(a.qtip){ if(this.textNode.setAttributeNS){ this.textNode.setAttributeNS("ext", "qtip", a.qtip); if(a.qtipTitle){ this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle); } }else{ this.textNode.setAttribute("ext:qtip", a.qtip); if(a.qtipTitle){ this.textNode.setAttribute("ext:qtitle", a.qtipTitle); } } }else if(a.qtipCfg){ a.qtipCfg.target = Ext.id(this.textNode); Ext.QuickTips.register(a.qtipCfg); } this.initEvents(); if(!this.node.expanded){ this.updateExpandIcon(true); } }else{ if(bulkRender === true) { targetNode.appendChild(this.wrap); } } }, renderElements : function(n, a, targetNode, bulkRender){ this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : ''; var cb = typeof a.checked == 'boolean'; var href = a.href ? a.href : Ext.isGecko ? "" : "#"; var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">', '<span class="x-tree-node-indent">',this.indentMarkup,"</span>", '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />', '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />', cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '', '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ', a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>", '<ul class="x-tree-node-ct" style="display:none;"></ul>', "</li>"].join(''); var nel; if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){ this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf); }else{ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf); } this.elNode = this.wrap.childNodes[0]; this.ctNode = this.wrap.childNodes[1]; var cs = this.elNode.childNodes; this.indentNode = cs[0]; this.ecNode = cs[1]; this.iconNode = cs[2]; var index = 3; if(cb){ this.checkbox = cs[3]; index++; } this.anchor = cs[index]; this.textNode = cs[index].firstChild; }, getAnchor : function(){ return this.anchor; }, getTextEl : function(){ return this.textNode; }, getIconEl : function(){ return this.iconNode; }, isChecked : function(){ return this.checkbox ? this.checkbox.checked : false; }, updateExpandIcon : function(){ if(this.rendered){ var n = this.node, c1, c2; var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow"; var hasChild = n.hasChildNodes(); if(hasChild || n.attributes.expandable){ if(n.expanded){ cls += "-minus"; c1 = "x-tree-node-collapsed"; c2 = "x-tree-node-expanded"; }else{ cls += "-plus"; c1 = "x-tree-node-expanded"; c2 = "x-tree-node-collapsed"; } if(this.wasLeaf){ this.removeClass("x-tree-node-leaf"); this.wasLeaf = false; } if(this.c1 != c1 || this.c2 != c2){ Ext.fly(this.elNode).replaceClass(c1, c2); this.c1 = c1; this.c2 = c2; } }else{ if(!this.wasLeaf){ Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf"); delete this.c1; delete this.c2; this.wasLeaf = true; } } var ecc = "x-tree-ec-icon "+cls; if(this.ecc != ecc){ this.ecNode.className = ecc; this.ecc = ecc; } } }, getChildIndent : function(){ if(!this.childIndent){ var buf = []; var p = this.node; while(p){ if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){ if(!p.isLast()) { buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />'); } else { buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />'); } } p = p.parentNode; } this.childIndent = buf.join(""); } return this.childIndent; }, renderIndent : function(){ if(this.rendered){ var indent = ""; var p = this.node.parentNode; if(p){ indent = p.ui.getChildIndent(); } if(this.indentMarkup != indent){ this.indentNode.innerHTML = indent; this.indentMarkup = indent; } this.updateExpandIcon(); } }, destroy : function(){ if(this.elNode){ Ext.dd.Registry.unregister(this.elNode.id); } delete this.elNode; delete this.ctNode; delete this.indentNode; delete this.ecNode; delete this.iconNode; delete this.checkbox; delete this.anchor; delete this.textNode; Ext.removeNode(this.ctNode); } }; Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { render : function(){ if(!this.rendered){ var targetNode = this.node.ownerTree.innerCt.dom; this.node.expanded = true; targetNode.innerHTML = '<div class="x-tree-root-node"></div>'; this.wrap = this.ctNode = targetNode.firstChild; } }, collapse : Ext.emptyFn, expand : Ext.emptyFn }); Ext.tree.TreeLoader = function(config){ this.baseParams = {}; this.requestMethod = "POST"; Ext.apply(this, config); this.addEvents( "beforeload", "load", "loadexception" ); Ext.tree.TreeLoader.superclass.constructor.call(this); }; Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, { uiProviders : {}, clearOnLoad : true, load : function(node, callback){ if(this.clearOnLoad){ while(node.firstChild){ node.removeChild(node.firstChild); } } if(this.doPreload(node)){ if(typeof callback == "function"){ callback(); } }else if(this.dataUrl||this.url){ this.requestData(node, callback); } }, doPreload : function(node){ if(node.attributes.children){ if(node.childNodes.length < 1){ var cs = node.attributes.children; node.beginUpdate(); for(var i = 0, len = cs.length; i < len; i++){ var cn = node.appendChild(this.createNode(cs[i])); if(this.preloadChildren){ this.doPreload(cn); } } node.endUpdate(); } return true; }else { return false; } }, getParams: function(node){ var buf = [], bp = this.baseParams; for(var key in bp){ if(typeof bp[key] != "function"){ buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&"); } } buf.push("node=", encodeURIComponent(node.id)); return buf.join(""); }, requestData : function(node, callback){ if(this.fireEvent("beforeload", this, node, callback) !== false){ this.transId = Ext.Ajax.request({ method:this.requestMethod, url: this.dataUrl||this.url, success: this.handleResponse, failure: this.handleFailure, scope: this, argument: {callback: callback, node: node}, params: this.getParams(node) }); }else{ if(typeof callback == "function"){ callback(); } } }, isLoading : function(){ return this.transId ? true : false; }, abort : function(){ if(this.isLoading()){ Ext.Ajax.abort(this.transId); } }, createNode : function(attr){ if(this.baseAttrs){ Ext.applyIf(attr, this.baseAttrs); } if(this.applyLoader !== false){ attr.loader = this; } if(typeof attr.uiProvider == 'string'){ attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider); } return(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr)); }, processResponse : function(response, node, callback){ var json = response.responseText; try { var o = eval("("+json+")"); node.beginUpdate(); for(var i = 0, len = o.length; i < len; i++){ var n = this.createNode(o[i]); if(n){ node.appendChild(n); } } node.endUpdate(); if(typeof callback == "function"){ callback(this, node); } }catch(e){ this.handleFailure(response); } }, handleResponse : function(response){ this.transId = false; var a = response.argument; this.processResponse(response, a.node, a.callback); this.fireEvent("load", this, a.node, response); }, handleFailure : function(response){ this.transId = false; var a = response.argument; this.fireEvent("loadexception", this, a.node, response); if(typeof a.callback == "function"){ a.callback(this, a.node); } } }); Ext.tree.TreeFilter = function(tree, config){ this.tree = tree; this.filtered = {}; Ext.apply(this, config); }; Ext.tree.TreeFilter.prototype = { clearBlank:false, reverse:false, autoClear:false, remove:false, filter : function(value, attr, startNode){ attr = attr || "text"; var f; if(typeof value == "string"){ var vlen = value.length; if(vlen == 0 && this.clearBlank){ this.clear(); return; } value = value.toLowerCase(); f = function(n){ return n.attributes[attr].substr(0, vlen).toLowerCase() == value; }; }else if(value.exec){ f = function(n){ return value.test(n.attributes[attr]); }; }else{ throw 'Illegal filter type, must be string or regex'; } this.filterBy(f, null, startNode); }, filterBy : function(fn, scope, startNode){ startNode = startNode || this.tree.root; if(this.autoClear){ this.clear(); } var af = this.filtered, rv = this.reverse; var f = function(n){ if(n == startNode){ return true; } if(af[n.id]){ return false; } var m = fn.call(scope || n, n); if(!m || rv){ af[n.id] = n; n.ui.hide(); return false; } return true; }; startNode.cascade(f); if(this.remove){ for(var id in af){ if(typeof id != "function"){ var n = af[id]; if(n && n.parentNode){ n.parentNode.removeChild(n); } } } } }, clear : function(){ var t = this.tree; var af = this.filtered; for(var id in af){ if(typeof id != "function"){ var n = af[id]; if(n){ n.ui.show(); } } } this.filtered = {}; } }; Ext.tree.TreeSorter = function(tree, config){ Ext.apply(this, config); tree.on("beforechildrenrendered", this.doSort, this); tree.on("append", this.updateSort, this); tree.on("insert", this.updateSort, this); tree.on("textchange", this.updateSortParent, this); var dsc = this.dir && this.dir.toLowerCase() == "desc"; var p = this.property || "text"; var sortType = this.sortType; var fs = this.folderSort; var cs = this.caseSensitive === true; var leafAttr = this.leafAttr || 'leaf'; this.sortFn = function(n1, n2){ if(fs){ if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){ return 1; } if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){ return -1; } } var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase()); var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase()); if(v1 < v2){ return dsc ? +1 : -1; }else if(v1 > v2){ return dsc ? -1 : +1; }else{ return 0; } }; }; Ext.tree.TreeSorter.prototype = { doSort : function(node){ node.sort(this.sortFn); }, compareNodes : function(n1, n2){ return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1); }, updateSort : function(tree, node){ if(node.childrenRendered){ this.doSort.defer(1, this, [node]); } }, updateSortParent : function(node){ var p = node.parentNode; if(p && p.childrenRendered){ this.doSort.defer(1, this, [p]); } } }; if(Ext.dd.DropZone){ Ext.tree.TreeDropZone = function(tree, config){ this.allowParentInsert = false; this.allowContainerDrop = false; this.appendOnly = false; Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.innerCt, config); this.tree = tree; this.dragOverData = {}; this.lastInsertClass = "x-tree-no-status"; }; Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, { ddGroup : "TreeDD", expandDelay : 1000, expandNode : function(node){ if(node.hasChildNodes() && !node.isExpanded()){ node.expand(false, null, this.triggerCacheRefresh.createDelegate(this)); } }, queueExpand : function(node){ this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]); }, cancelExpand : function(){ if(this.expandProcId){ clearTimeout(this.expandProcId); this.expandProcId = false; } }, isValidDropPoint : function(n, pt, dd, e, data){ if(!n || !data){ return false; } var targetNode = n.node; var dropNode = data.node; if(!(targetNode && targetNode.isTarget && pt)){ return false; } if(pt == "append" && targetNode.allowChildren === false){ return false; } if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){ return false; } if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){ return false; } var overEvent = this.dragOverData; overEvent.tree = this.tree; overEvent.target = targetNode; overEvent.data = data; overEvent.point = pt; overEvent.source = dd; overEvent.rawEvent = e; overEvent.dropNode = dropNode; overEvent.cancel = false; var result = this.tree.fireEvent("nodedragover", overEvent); return overEvent.cancel === false && result !== false; }, getDropPoint : function(e, n, dd){ var tn = n.node; if(tn.isRoot){ return tn.allowChildren !== false ? "append" : false; } var dragEl = n.ddel; var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight; var y = Ext.lib.Event.getPageY(e); var noAppend = tn.allowChildren === false || tn.isLeaf(); if(this.appendOnly || tn.parentNode.allowChildren === false){ return noAppend ? false : "append"; } var noBelow = false; if(!this.allowParentInsert){ noBelow = tn.hasChildNodes() && tn.isExpanded(); } var q = (b - t) / (noAppend ? 2 : 3); if(y >= t && y < (t + q)){ return "above"; }else if(!noBelow && (noAppend || y >= b-q && y <= b)){ return "below"; }else{ return "append"; } }, onNodeEnter : function(n, dd, e, data){ this.cancelExpand(); }, onNodeOver : function(n, dd, e, data){ var pt = this.getDropPoint(e, n, dd); var node = n.node; if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){ this.queueExpand(node); }else if(pt != "append"){ this.cancelExpand(); } var returnCls = this.dropNotAllowed; if(this.isValidDropPoint(n, pt, dd, e, data)){ if(pt){ var el = n.ddel; var cls; if(pt == "above"){ returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between"; cls = "x-tree-drag-insert-above"; }else if(pt == "below"){ returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between"; cls = "x-tree-drag-insert-below"; }else{ returnCls = "x-tree-drop-ok-append"; cls = "x-tree-drag-append"; } if(this.lastInsertClass != cls){ Ext.fly(el).replaceClass(this.lastInsertClass, cls); this.lastInsertClass = cls; } } } return returnCls; }, onNodeOut : function(n, dd, e, data){ this.cancelExpand(); this.removeDropIndicators(n); }, onNodeDrop : function(n, dd, e, data){ var point = this.getDropPoint(e, n, dd); var targetNode = n.node; targetNode.ui.startDrop(); if(!this.isValidDropPoint(n, point, dd, e, data)){ targetNode.ui.endDrop(); return false; } var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null); var dropEvent = { tree : this.tree, target: targetNode, data: data, point: point, source: dd, rawEvent: e, dropNode: dropNode, cancel: !dropNode, dropStatus: false }; var retval = this.tree.fireEvent("beforenodedrop", dropEvent); if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){ targetNode.ui.endDrop(); return dropEvent.dropStatus; } targetNode = dropEvent.target; if(point == "append" && !targetNode.isExpanded()){ targetNode.expand(false, null, function(){ this.completeDrop(dropEvent); }.createDelegate(this)); }else{ this.completeDrop(dropEvent); } return true; }, completeDrop : function(de){ var ns = de.dropNode, p = de.point, t = de.target; if(!Ext.isArray(ns)){ ns = [ns]; } var n; for(var i = 0, len = ns.length; i < len; i++){ n = ns[i]; if(p == "above"){ t.parentNode.insertBefore(n, t); }else if(p == "below"){ t.parentNode.insertBefore(n, t.nextSibling); }else{ t.appendChild(n); } } n.ui.focus(); if(this.tree.hlDrop){ n.ui.highlight(); } t.ui.endDrop(); this.tree.fireEvent("nodedrop", de); }, afterNodeMoved : function(dd, data, e, targetNode, dropNode){ if(this.tree.hlDrop){ dropNode.ui.focus(); dropNode.ui.highlight(); } this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e); }, getTree : function(){ return this.tree; }, removeDropIndicators : function(n){ if(n && n.ddel){ var el = n.ddel; Ext.fly(el).removeClass([ "x-tree-drag-insert-above", "x-tree-drag-insert-below", "x-tree-drag-append"]); this.lastInsertClass = "_noclass"; } }, beforeDragDrop : function(target, e, id){ this.cancelExpand(); return true; }, afterRepair : function(data){ if(data && Ext.enableFx){ data.node.ui.highlight(); } this.hideProxy(); } }); } if(Ext.dd.DragZone){ Ext.tree.TreeDragZone = function(tree, config){ Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config); this.tree = tree; }; Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, { ddGroup : "TreeDD", onBeforeDrag : function(data, e){ var n = data.node; return n && n.draggable && !n.disabled; }, onInitDrag : function(e){ var data = this.dragData; this.tree.getSelectionModel().select(data.node); this.tree.eventModel.disable(); this.proxy.update(""); data.node.ui.appendDDGhost(this.proxy.ghost.dom); this.tree.fireEvent("startdrag", this.tree, data.node, e); }, getRepairXY : function(e, data){ return data.node.ui.getDDRepairXY(); }, onEndDrag : function(data, e){ this.tree.eventModel.enable.defer(100, this.tree.eventModel); this.tree.fireEvent("enddrag", this.tree, data.node, e); }, onValidDrop : function(dd, e, id){ this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e); this.hideProxy(); }, beforeInvalidDrop : function(e, id){ var sm = this.tree.getSelectionModel(); sm.clearSelections(); sm.select(this.dragData.node); } }); } Ext.tree.TreeEditor = function(tree, config){ config = config || {}; var field = config.events ? config : new Ext.form.TextField(config); Ext.tree.TreeEditor.superclass.constructor.call(this, field); this.tree = tree; if(!tree.rendered){ tree.on('render', this.initEditor, this); }else{ this.initEditor(tree); } }; Ext.extend(Ext.tree.TreeEditor, Ext.Editor, { alignment: "l-l", autoSize: false, hideEl : false, cls: "x-small-editor x-tree-editor", shim:false, shadow:"frame", maxWidth: 250, editDelay : 350, initEditor : function(tree){ tree.on('beforeclick', this.beforeNodeClick, this); tree.on('dblclick', this.onNodeDblClick, this); this.on('complete', this.updateNode, this); this.on('beforestartedit', this.fitToTree, this); this.on('startedit', this.bindScroll, this, {delay:10}); this.on('specialkey', this.onSpecialKey, this); }, fitToTree : function(ed, el){ var td = this.tree.getTreeEl().dom, nd = el.dom; if(td.scrollLeft > nd.offsetLeft){ td.scrollLeft = nd.offsetLeft; } var w = Math.min( this.maxWidth, (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - 5); this.setSize(w, ''); }, triggerEdit : function(node, defer){ this.completeEdit(); if(node.attributes.editable !== false){ this.editNode = node; this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, node.text]); return false; } }, bindScroll : function(){ this.tree.getTreeEl().on('scroll', this.cancelEdit, this); }, beforeNodeClick : function(node, e){ clearTimeout(this.autoEditTimer); if(this.tree.getSelectionModel().isSelected(node)){ e.stopEvent(); return this.triggerEdit(node); } }, onNodeDblClick : function(node, e){ clearTimeout(this.autoEditTimer); }, updateNode : function(ed, value){ this.tree.getTreeEl().un('scroll', this.cancelEdit, this); this.editNode.setText(value); }, onHide : function(){ Ext.tree.TreeEditor.superclass.onHide.call(this); if(this.editNode){ this.editNode.ui.focus.defer(50, this.editNode.ui); } }, onSpecialKey : function(field, e){ var k = e.getKey(); if(k == e.ESC){ e.stopEvent(); this.cancelEdit(); }else if(k == e.ENTER && !e.hasModifier()){ e.stopEvent(); this.completeEdit(); } } }); Ext.menu.Menu = function(config){ if(Ext.isArray(config)){ config = {items:config}; } Ext.apply(this, config); this.id = this.id || Ext.id(); this.addEvents( 'beforeshow', 'beforehide', 'show', 'hide', 'click', 'mouseover', 'mouseout', 'itemclick' ); Ext.menu.MenuMgr.register(this); Ext.menu.Menu.superclass.constructor.call(this); var mis = this.items; this.items = new Ext.util.MixedCollection(); if(mis){ this.add.apply(this, mis); } }; Ext.extend(Ext.menu.Menu, Ext.util.Observable, { minWidth : 120, shadow : "sides", subMenuAlign : "tl-tr?", defaultAlign : "tl-bl?", allowOtherMenus : false, hidden:true, createEl : function(){ return new Ext.Layer({ cls: "x-menu", shadow:this.shadow, constrain: false, parentEl: this.parentEl || document.body, zindex:15000 }); }, render : function(){ if(this.el){ return; } var el = this.el = this.createEl(); if(!this.keyNav){ this.keyNav = new Ext.menu.MenuNav(this); } if(this.plain){ el.addClass("x-menu-plain"); } if(this.cls){ el.addClass(this.cls); } this.focusEl = el.createChild({ tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1" }); var ul = el.createChild({tag: "ul", cls: "x-menu-list"}); ul.on("click", this.onClick, this); ul.on("mouseover", this.onMouseOver, this); ul.on("mouseout", this.onMouseOut, this); this.items.each(function(item){ var li = document.createElement("li"); li.className = "x-menu-list-item"; ul.dom.appendChild(li); item.render(li, this); }, this); this.ul = ul; this.autoWidth(); }, autoWidth : function(){ var el = this.el, ul = this.ul; if(!el){ return; } var w = this.width; if(w){ el.setWidth(w); }else if(Ext.isIE){ el.setWidth(this.minWidth); var t = el.dom.offsetWidth; el.setWidth(ul.getWidth()+el.getFrameWidth("lr")); } }, delayAutoWidth : function(){ if(this.el){ if(!this.awTask){ this.awTask = new Ext.util.DelayedTask(this.autoWidth, this); } this.awTask.delay(20); } }, findTargetItem : function(e){ var t = e.getTarget(".x-menu-list-item", this.ul, true); if(t && t.menuItemId){ return this.items.get(t.menuItemId); } }, onClick : function(e){ var t; if(t = this.findTargetItem(e)){ t.onClick(e); this.fireEvent("click", this, t, e); } }, setActiveItem : function(item, autoExpand){ if(item != this.activeItem){ if(this.activeItem){ this.activeItem.deactivate(); } this.activeItem = item; item.activate(autoExpand); }else if(autoExpand){ item.expandMenu(); } }, tryActivate : function(start, step){ var items = this.items; for(var i = start, len = items.length; i >= 0 && i < len; i+= step){ var item = items.get(i); if(!item.disabled && item.canActivate){ this.setActiveItem(item, false); return item; } } return false; }, onMouseOver : function(e){ var t; if(t = this.findTargetItem(e)){ if(t.canActivate && !t.disabled){ this.setActiveItem(t, true); } } this.fireEvent("mouseover", this, e, t); }, onMouseOut : function(e){ var t; if(t = this.findTargetItem(e)){ if(t == this.activeItem && t.shouldDeactivate(e)){ this.activeItem.deactivate(); delete this.activeItem; } } this.fireEvent("mouseout", this, e, t); }, isVisible : function(){ return this.el && !this.hidden; }, show : function(el, pos, parentMenu){ this.parentMenu = parentMenu; if(!this.el){ this.render(); } this.fireEvent("beforeshow", this); this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false); }, showAt : function(xy, parentMenu, _e){ this.parentMenu = parentMenu; if(!this.el){ this.render(); } if(_e !== false){ this.fireEvent("beforeshow", this); xy = this.el.adjustForConstraints(xy); } this.el.setXY(xy); this.el.show(); this.hidden = false; this.focus(); this.fireEvent("show", this); }, focus : function(){ if(!this.hidden){ this.doFocus.defer(50, this); } }, doFocus : function(){ if(!this.hidden){ this.focusEl.focus(); } }, hide : function(deep){ if(this.el && this.isVisible()){ this.fireEvent("beforehide", this); if(this.activeItem){ this.activeItem.deactivate(); this.activeItem = null; } this.el.hide(); this.hidden = true; this.fireEvent("hide", this); } if(deep === true && this.parentMenu){ this.parentMenu.hide(true); } }, add : function(){ var a = arguments, l = a.length, item; for(var i = 0; i < l; i++){ var el = a[i]; if(el.render){ item = this.addItem(el); }else if(typeof el == "string"){ if(el == "separator" || el == "-"){ item = this.addSeparator(); }else{ item = this.addText(el); } }else if(el.tagName || el.el){ item = this.addElement(el); }else if(typeof el == "object"){ Ext.applyIf(el, this.defaults); item = this.addMenuItem(el); } } return item; }, getEl : function(){ if(!this.el){ this.render(); } return this.el; }, addSeparator : function(){ return this.addItem(new Ext.menu.Separator()); }, addElement : function(el){ return this.addItem(new Ext.menu.BaseItem(el)); }, addItem : function(item){ this.items.add(item); if(this.ul){ var li = document.createElement("li"); li.className = "x-menu-list-item"; this.ul.dom.appendChild(li); item.render(li, this); this.delayAutoWidth(); } return item; }, addMenuItem : function(config){ if(!(config instanceof Ext.menu.Item)){ if(typeof config.checked == "boolean"){ config = new Ext.menu.CheckItem(config); }else{ config = new Ext.menu.Item(config); } } return this.addItem(config); }, addText : function(text){ return this.addItem(new Ext.menu.TextItem(text)); }, insert : function(index, item){ this.items.insert(index, item); if(this.ul){ var li = document.createElement("li"); li.className = "x-menu-list-item"; this.ul.dom.insertBefore(li, this.ul.dom.childNodes[index]); item.render(li, this); this.delayAutoWidth(); } return item; }, remove : function(item){ this.items.removeKey(item.id); item.destroy(); }, removeAll : function(){ var f; while(f = this.items.first()){ this.remove(f); } }, destroy : function(){ this.beforeDestroy(); Ext.menu.MenuMgr.unregister(this); if (this.keyNav) { this.keyNav.disable(); } this.removeAll(); if (this.ul) { this.ul.removeAllListeners(); } if (this.el) { this.el.destroy(); } }, beforeDestroy : Ext.emptyFn }); Ext.menu.MenuNav = function(menu){ Ext.menu.MenuNav.superclass.constructor.call(this, menu.el); this.scope = this.menu = menu; }; Ext.extend(Ext.menu.MenuNav, Ext.KeyNav, { doRelay : function(e, h){ var k = e.getKey(); if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){ this.menu.tryActivate(0, 1); return false; } return h.call(this.scope || this, e, this.menu); }, up : function(e, m){ if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){ m.tryActivate(m.items.length-1, -1); } }, down : function(e, m){ if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){ m.tryActivate(0, 1); } }, right : function(e, m){ if(m.activeItem){ m.activeItem.expandMenu(true); } }, left : function(e, m){ m.hide(); if(m.parentMenu && m.parentMenu.activeItem){ m.parentMenu.activeItem.activate(); } }, enter : function(e, m){ if(m.activeItem){ e.stopPropagation(); m.activeItem.onClick(e); m.fireEvent("click", this, m.activeItem); return true; } } }); Ext.menu.MenuMgr = function(){ var menus, active, groups = {}, attached = false, lastShow = new Date(); function init(){ menus = {}; active = new Ext.util.MixedCollection(); Ext.getDoc().addKeyListener(27, function(){ if(active.length > 0){ hideAll(); } }); } function hideAll(){ if(active && active.length > 0){ var c = active.clone(); c.each(function(m){ m.hide(); }); } } function onHide(m){ active.remove(m); if(active.length < 1){ Ext.getDoc().un("mousedown", onMouseDown); attached = false; } } function onShow(m){ var last = active.last(); lastShow = new Date(); active.add(m); if(!attached){ Ext.getDoc().on("mousedown", onMouseDown); attached = true; } if(m.parentMenu){ m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3); m.parentMenu.activeChild = m; }else if(last && last.isVisible()){ m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3); } } function onBeforeHide(m){ if(m.activeChild){ m.activeChild.hide(); } if(m.autoHideTimer){ clearTimeout(m.autoHideTimer); delete m.autoHideTimer; } } function onBeforeShow(m){ var pm = m.parentMenu; if(!pm && !m.allowOtherMenus){ hideAll(); }else if(pm && pm.activeChild){ pm.activeChild.hide(); } } function onMouseDown(e){ if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){ hideAll(); } } function onBeforeCheck(mi, state){ if(state){ var g = groups[mi.group]; for(var i = 0, l = g.length; i < l; i++){ if(g[i] != mi){ g[i].setChecked(false); } } } } return { hideAll : function(){ hideAll(); }, register : function(menu){ if(!menus){ init(); } menus[menu.id] = menu; menu.on("beforehide", onBeforeHide); menu.on("hide", onHide); menu.on("beforeshow", onBeforeShow); menu.on("show", onShow); var g = menu.group; if(g && menu.events["checkchange"]){ if(!groups[g]){ groups[g] = []; } groups[g].push(menu); menu.on("checkchange", onCheck); } }, get : function(menu){ if(typeof menu == "string"){ if(!menus){ return null; } return menus[menu]; }else if(menu.events){ return menu; }else if(typeof menu.length == 'number'){ return new Ext.menu.Menu({items:menu}); }else{ return new Ext.menu.Menu(menu); } }, unregister : function(menu){ delete menus[menu.id]; menu.un("beforehide", onBeforeHide); menu.un("hide", onHide); menu.un("beforeshow", onBeforeShow); menu.un("show", onShow); var g = menu.group; if(g && menu.events["checkchange"]){ groups[g].remove(menu); menu.un("checkchange", onCheck); } }, registerCheckable : function(menuItem){ var g = menuItem.group; if(g){ if(!groups[g]){ groups[g] = []; } groups[g].push(menuItem); menuItem.on("beforecheckchange", onBeforeCheck); } }, unregisterCheckable : function(menuItem){ var g = menuItem.group; if(g){ groups[g].remove(menuItem); menuItem.un("beforecheckchange", onBeforeCheck); } }, getCheckedItem : function(groupId){ var g = groups[groupId]; if(g){ for(var i = 0, l = g.length; i < l; i++){ if(g[i].checked){ return g[i]; } } } return null; }, setCheckedItem : function(groupId, itemId){ var g = groups[groupId]; if(g){ for(var i = 0, l = g.length; i < l; i++){ if(g[i].id == itemId){ g[i].setChecked(true); } } } return null; } }; }(); Ext.menu.BaseItem = function(config){ Ext.menu.BaseItem.superclass.constructor.call(this, config); this.addEvents( 'click', 'activate', 'deactivate' ); if(this.handler){ this.on("click", this.handler, this.scope); } }; Ext.extend(Ext.menu.BaseItem, Ext.Component, { canActivate : false, activeClass : "x-menu-item-active", hideOnClick : true, hideDelay : 100, ctype: "Ext.menu.BaseItem", actionMode : "container", render : function(container, parentMenu){ this.parentMenu = parentMenu; Ext.menu.BaseItem.superclass.render.call(this, container); this.container.menuItemId = this.id; }, onRender : function(container, position){ this.el = Ext.get(this.el); container.dom.appendChild(this.el.dom); }, setHandler : function(handler, scope){ if(this.handler){ this.un("click", this.handler, this.scope); } this.on("click", this.handler = handler, this.scope = scope); }, onClick : function(e){ if(!this.disabled && this.fireEvent("click", this, e) !== false && this.parentMenu.fireEvent("itemclick", this, e) !== false){ this.handleClick(e); }else{ e.stopEvent(); } }, activate : function(){ if(this.disabled){ return false; } var li = this.container; li.addClass(this.activeClass); this.region = li.getRegion().adjust(2, 2, -2, -2); this.fireEvent("activate", this); return true; }, deactivate : function(){ this.container.removeClass(this.activeClass); this.fireEvent("deactivate", this); }, shouldDeactivate : function(e){ return !this.region || !this.region.contains(e.getPoint()); }, handleClick : function(e){ if(this.hideOnClick){ this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]); } }, expandMenu : function(autoActivate){ }, hideMenu : function(){ } }); Ext.menu.TextItem = function(text){ this.text = text; Ext.menu.TextItem.superclass.constructor.call(this); }; Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, { hideOnClick : false, itemCls : "x-menu-text", onRender : function(){ var s = document.createElement("span"); s.className = this.itemCls; s.innerHTML = this.text; this.el = s; Ext.menu.TextItem.superclass.onRender.apply(this, arguments); } }); Ext.menu.Separator = function(config){ Ext.menu.Separator.superclass.constructor.call(this, config); }; Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, { itemCls : "x-menu-sep", hideOnClick : false, onRender : function(li){ var s = document.createElement("span"); s.className = this.itemCls; s.innerHTML = "&#160;"; this.el = s; li.addClass("x-menu-sep-li"); Ext.menu.Separator.superclass.onRender.apply(this, arguments); } }); Ext.menu.Item = function(config){ Ext.menu.Item.superclass.constructor.call(this, config); if(this.menu){ this.menu = Ext.menu.MenuMgr.get(this.menu); } }; Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, { itemCls : "x-menu-item", canActivate : true, showDelay: 200, hideDelay: 200, ctype: "Ext.menu.Item", onRender : function(container, position){ var el = document.createElement("a"); el.hideFocus = true; el.unselectable = "on"; el.href = this.href || "#"; if(this.hrefTarget){ el.target = this.hrefTarget; } el.className = this.itemCls + (this.menu ? " x-menu-item-arrow" : "") + (this.cls ? " " + this.cls : ""); el.innerHTML = String.format( '<img src="{0}" class="x-menu-item-icon {2}" />{1}', this.icon || Ext.BLANK_IMAGE_URL, this.itemText||this.text, this.iconCls || ''); this.el = el; Ext.menu.Item.superclass.onRender.call(this, container, position); }, setText : function(text){ this.text = text; if(this.rendered){ this.el.update(String.format( '<img src="{0}" class="x-menu-item-icon {2}">{1}', this.icon || Ext.BLANK_IMAGE_URL, this.text, this.iconCls || '')); this.parentMenu.autoWidth(); } }, setIconClass : function(cls){ var oldCls = this.iconCls; this.iconCls = cls; if(this.rendered){ this.el.child('img.x-menu-item-icon').replaceClass(oldCls, this.iconCls); } }, handleClick : function(e){ if(!this.href){ e.stopEvent(); } Ext.menu.Item.superclass.handleClick.apply(this, arguments); }, activate : function(autoExpand){ if(Ext.menu.Item.superclass.activate.apply(this, arguments)){ this.focus(); if(autoExpand){ this.expandMenu(); } } return true; }, shouldDeactivate : function(e){ if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){ if(this.menu && this.menu.isVisible()){ return !this.menu.getEl().getRegion().contains(e.getPoint()); } return true; } return false; }, deactivate : function(){ Ext.menu.Item.superclass.deactivate.apply(this, arguments); this.hideMenu(); }, expandMenu : function(autoActivate){ if(!this.disabled && this.menu){ clearTimeout(this.hideTimer); delete this.hideTimer; if(!this.menu.isVisible() && !this.showTimer){ this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]); }else if (this.menu.isVisible() && autoActivate){ this.menu.tryActivate(0, 1); } } }, deferExpand : function(autoActivate){ delete this.showTimer; this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu); if(autoActivate){ this.menu.tryActivate(0, 1); } }, hideMenu : function(){ clearTimeout(this.showTimer); delete this.showTimer; if(!this.hideTimer && this.menu && this.menu.isVisible()){ this.hideTimer = this.deferHide.defer(this.hideDelay, this); } }, deferHide : function(){ delete this.hideTimer; this.menu.hide(); } }); Ext.menu.CheckItem = function(config){ Ext.menu.CheckItem.superclass.constructor.call(this, config); this.addEvents( "beforecheckchange" , "checkchange" ); if(this.checkHandler){ this.on('checkchange', this.checkHandler, this.scope); } Ext.menu.MenuMgr.registerCheckable(this); }; Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, { itemCls : "x-menu-item x-menu-check-item", groupClass : "x-menu-group-item", checked: false, ctype: "Ext.menu.CheckItem", onRender : function(c){ Ext.menu.CheckItem.superclass.onRender.apply(this, arguments); if(this.group){ this.el.addClass(this.groupClass); } if(this.checked){ this.checked = false; this.setChecked(true, true); } }, destroy : function(){ Ext.menu.MenuMgr.unregisterCheckable(this); Ext.menu.CheckItem.superclass.destroy.apply(this, arguments); }, setChecked : function(state, suppressEvent){ if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){ if(this.container){ this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked"); } this.checked = state; if(suppressEvent !== true){ this.fireEvent("checkchange", this, state); } } }, handleClick : function(e){ if(!this.disabled && !(this.checked && this.group)){ this.setChecked(!this.checked); } Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments); } }); Ext.menu.Adapter = function(component, config){ Ext.menu.Adapter.superclass.constructor.call(this, config); this.component = component; }; Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, { canActivate : true, onRender : function(container, position){ this.component.render(container); this.el = this.component.getEl(); }, activate : function(){ if(this.disabled){ return false; } this.component.focus(); this.fireEvent("activate", this); return true; }, deactivate : function(){ this.fireEvent("deactivate", this); }, disable : function(){ this.component.disable(); Ext.menu.Adapter.superclass.disable.call(this); }, enable : function(){ this.component.enable(); Ext.menu.Adapter.superclass.enable.call(this); } }); Ext.menu.DateItem = function(config){ Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config); this.picker = this.component; this.addEvents('select'); this.picker.on("render", function(picker){ picker.getEl().swallowEvent("click"); picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter, { onSelect : function(picker, date){ this.fireEvent("select", this, date, picker); Ext.menu.DateItem.superclass.handleClick.call(this); } }); Ext.menu.ColorItem = function(config){ Ext.menu.ColorItem.superclass.constructor.call(this, new Ext.ColorPalette(config), config); this.palette = this.component; this.relayEvents(this.palette, ["select"]); if(this.selectHandler){ this.on('select', this.selectHandler, this.scope); } }; Ext.extend(Ext.menu.ColorItem, Ext.menu.Adapter); Ext.menu.DateMenu = function(config){ Ext.menu.DateMenu.superclass.constructor.call(this, config); this.plain = true; var di = new Ext.menu.DateItem(config); this.add(di); this.picker = di.picker; this.relayEvents(di, ["select"]); this.on('beforeshow', function(){ if(this.picker){ this.picker.hideMonthPicker(true); } }, this); }; Ext.extend(Ext.menu.DateMenu, Ext.menu.Menu, { cls:'x-date-menu', beforeDestroy : function() { this.picker.destroy(); } }); Ext.menu.ColorMenu = function(config){ Ext.menu.ColorMenu.superclass.constructor.call(this, config); this.plain = true; var ci = new Ext.menu.ColorItem(config); this.add(ci); this.palette = ci.palette; this.relayEvents(ci, ["select"]); }; Ext.extend(Ext.menu.ColorMenu, Ext.menu.Menu); Ext.form.Field = Ext.extend(Ext.BoxComponent, { invalidClass : "x-form-invalid", invalidText : "The value in this field is invalid", focusClass : "x-form-focus", validationEvent : "keyup", validateOnBlur : true, validationDelay : 250, defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"}, fieldClass : "x-form-field", msgTarget : 'qtip', msgFx : 'normal', readOnly : false, disabled : false, isFormField : true, hasFocus : false, initComponent : function(){ Ext.form.Field.superclass.initComponent.call(this); this.addEvents( 'focus', 'blur', 'specialkey', 'change', 'invalid', 'valid' ); }, getName: function(){ return this.rendered && this.el.dom.name ? this.el.dom.name : (this.hiddenName || ''); }, onRender : function(ct, position){ Ext.form.Field.superclass.onRender.call(this, ct, position); if(!this.el){ var cfg = this.getAutoCreate(); if(!cfg.name){ cfg.name = this.name || this.id; } if(this.inputType){ cfg.type = this.inputType; } this.el = ct.createChild(cfg, position); } var type = this.el.dom.type; if(type){ if(type == 'password'){ type = 'text'; } this.el.addClass('x-form-'+type); } if(this.readOnly){ this.el.dom.readOnly = true; } if(this.tabIndex !== undefined){ this.el.dom.setAttribute('tabIndex', this.tabIndex); } this.el.addClass([this.fieldClass, this.cls]); this.initValue(); }, initValue : function(){ if(this.value !== undefined){ this.setValue(this.value); }else if(this.el.dom.value.length > 0){ this.setValue(this.el.dom.value); } }, isDirty : function() { if(this.disabled) { return false; } return String(this.getValue()) !== String(this.originalValue); }, afterRender : function(){ Ext.form.Field.superclass.afterRender.call(this); this.initEvents(); }, fireKey : function(e){ if(e.isSpecialKey()){ this.fireEvent("specialkey", this, e); } }, reset : function(){ this.setValue(this.originalValue); this.clearInvalid(); }, initEvents : function(){ this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey, this); this.el.on("focus", this.onFocus, this); this.el.on("blur", this.onBlur, this); this.originalValue = this.getValue(); }, onFocus : function(){ if(!Ext.isOpera && this.focusClass){ this.el.addClass(this.focusClass); } if(!this.hasFocus){ this.hasFocus = true; this.startValue = this.getValue(); this.fireEvent("focus", this); } }, beforeBlur : Ext.emptyFn, onBlur : function(){ this.beforeBlur(); if(!Ext.isOpera && this.focusClass){ this.el.removeClass(this.focusClass); } this.hasFocus = false; if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){ this.validate(); } var v = this.getValue(); if(String(v) !== String(this.startValue)){ this.fireEvent('change', this, v, this.startValue); } this.fireEvent("blur", this); }, isValid : function(preventMark){ if(this.disabled){ return true; } var restore = this.preventMark; this.preventMark = preventMark === true; var v = this.validateValue(this.processValue(this.getRawValue())); this.preventMark = restore; return v; }, validate : function(){ if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){ this.clearInvalid(); return true; } return false; }, processValue : function(value){ return value; }, validateValue : function(value){ return true; }, markInvalid : function(msg){ if(!this.rendered || this.preventMark){ return; } this.el.addClass(this.invalidClass); msg = msg || this.invalidText; switch(this.msgTarget){ case 'qtip': this.el.dom.qtip = msg; this.el.dom.qclass = 'x-form-invalid-tip'; if(Ext.QuickTips){ Ext.QuickTips.enable(); } break; case 'title': this.el.dom.title = msg; break; case 'under': if(!this.errorEl){ var elp = this.el.findParent('.x-form-element', 5, true); this.errorEl = elp.createChild({cls:'x-form-invalid-msg'}); this.errorEl.setWidth(elp.getWidth(true)-20); } this.errorEl.update(msg); Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this); break; case 'side': if(!this.errorIcon){ var elp = this.el.findParent('.x-form-element', 5, true); this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'}); } this.alignErrorIcon(); this.errorIcon.dom.qtip = msg; this.errorIcon.dom.qclass = 'x-form-invalid-tip'; this.errorIcon.show(); this.on('resize', this.alignErrorIcon, this); break; default: var t = Ext.getDom(this.msgTarget); t.innerHTML = msg; t.style.display = this.msgDisplay; break; } this.fireEvent('invalid', this, msg); }, alignErrorIcon : function(){ this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]); }, clearInvalid : function(){ if(!this.rendered || this.preventMark){ return; } this.el.removeClass(this.invalidClass); switch(this.msgTarget){ case 'qtip': this.el.dom.qtip = ''; break; case 'title': this.el.dom.title = ''; break; case 'under': if(this.errorEl){ Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this); } break; case 'side': if(this.errorIcon){ this.errorIcon.dom.qtip = ''; this.errorIcon.hide(); this.un('resize', this.alignErrorIcon, this); } break; default: var t = Ext.getDom(this.msgTarget); t.innerHTML = ''; t.style.display = 'none'; break; } this.fireEvent('valid', this); }, getRawValue : function(){ var v = this.rendered ? this.el.getValue() : Ext.value(this.value, ''); if(v === this.emptyText){ v = ''; } return v; }, getValue : function(){ if(!this.rendered) { return this.value; } var v = this.el.getValue(); if(v === this.emptyText || v === undefined){ v = ''; } return v; }, setRawValue : function(v){ return this.el.dom.value = (v === null || v === undefined ? '' : v); }, setValue : function(v){ this.value = v; if(this.rendered){ this.el.dom.value = (v === null || v === undefined ? '' : v); this.validate(); } }, adjustSize : function(w, h){ var s = Ext.form.Field.superclass.adjustSize.call(this, w, h); s.width = this.adjustWidth(this.el.dom.tagName, s.width); return s; }, adjustWidth : function(tag, w){ tag = tag.toLowerCase(); if(typeof w == 'number' && !Ext.isSafari){ if(Ext.isIE && (tag == 'input' || tag == 'textarea')){ if(tag == 'input' && !Ext.isStrict){ return this.inEditor ? w : w - 3; } if(tag == 'input' && Ext.isStrict){ return w - (Ext.isIE6 ? 4 : 1); } if(tag = 'textarea' && Ext.isStrict){ return w-2; } }else if(Ext.isOpera && Ext.isStrict){ if(tag == 'input'){ return w + 2; } if(tag = 'textarea'){ return w-2; } } } return w; } }); Ext.form.Field.msgFx = { normal : { show: function(msgEl, f){ msgEl.setDisplayed('block'); }, hide : function(msgEl, f){ msgEl.setDisplayed(false).update(''); } }, slide : { show: function(msgEl, f){ msgEl.slideIn('t', {stopFx:true}); }, hide : function(msgEl, f){ msgEl.slideOut('t', {stopFx:true,useDisplay:true}); } }, slideRight : { show: function(msgEl, f){ msgEl.fixDisplay(); msgEl.alignTo(f.el, 'tl-tr'); msgEl.slideIn('l', {stopFx:true}); }, hide : function(msgEl, f){ msgEl.slideOut('l', {stopFx:true,useDisplay:true}); } } }; Ext.reg('field', Ext.form.Field); Ext.form.TextField = Ext.extend(Ext.form.Field, { grow : false, growMin : 30, growMax : 800, vtype : null, maskRe : null, disableKeyFilter : false, allowBlank : true, minLength : 0, maxLength : Number.MAX_VALUE, minLengthText : "The minimum length for this field is {0}", maxLengthText : "The maximum length for this field is {0}", selectOnFocus : false, blankText : "This field is required", validator : null, regex : null, regexText : "", emptyText : null, emptyClass : 'x-form-empty-field', initComponent : function(){ Ext.form.TextField.superclass.initComponent.call(this); this.addEvents( 'autosize' ); }, initEvents : function(){ Ext.form.TextField.superclass.initEvents.call(this); if(this.validationEvent == 'keyup'){ this.validationTask = new Ext.util.DelayedTask(this.validate, this); this.el.on('keyup', this.filterValidation, this); } else if(this.validationEvent !== false){ this.el.on(this.validationEvent, this.validate, this, {buffer: this.validationDelay}); } if(this.selectOnFocus || this.emptyText){ this.on("focus", this.preFocus, this); if(this.emptyText){ this.on('blur', this.postBlur, this); this.applyEmptyText(); } } if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){ this.el.on("keypress", this.filterKeys, this); } if(this.grow){ this.el.on("keyup", this.onKeyUp, this, {buffer:50}); this.el.on("click", this.autoSize, this); } }, processValue : function(value){ if(this.stripCharsRe){ var newValue = value.replace(this.stripCharsRe, ''); if(newValue !== value){ this.setRawValue(newValue); return newValue; } } return value; }, filterValidation : function(e){ if(!e.isNavKeyPress()){ this.validationTask.delay(this.validationDelay); } }, onKeyUp : function(e){ if(!e.isNavKeyPress()){ this.autoSize(); } }, reset : function(){ Ext.form.TextField.superclass.reset.call(this); this.applyEmptyText(); }, applyEmptyText : function(){ if(this.rendered && this.emptyText && this.getRawValue().length < 1){ this.setRawValue(this.emptyText); this.el.addClass(this.emptyClass); } }, preFocus : function(){ if(this.emptyText){ if(this.el.dom.value == this.emptyText){ this.setRawValue(''); } this.el.removeClass(this.emptyClass); } if(this.selectOnFocus){ this.el.dom.select(); } }, postBlur : function(){ this.applyEmptyText(); }, filterKeys : function(e){ var k = e.getKey(); if(!Ext.isIE && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){ return; } var c = e.getCharCode(), cc = String.fromCharCode(c); if(Ext.isIE && (e.isSpecialKey() || !cc)){ return; } if(!this.maskRe.test(cc)){ e.stopEvent(); } }, setValue : function(v){ if(this.emptyText && this.el && v !== undefined && v !== null && v !== ''){ this.el.removeClass(this.emptyClass); } Ext.form.TextField.superclass.setValue.apply(this, arguments); this.applyEmptyText(); this.autoSize(); }, validateValue : function(value){ if(value.length < 1 || value === this.emptyText){ if(this.allowBlank){ this.clearInvalid(); return true; }else{ this.markInvalid(this.blankText); return false; } } if(value.length < this.minLength){ this.markInvalid(String.format(this.minLengthText, this.minLength)); return false; } if(value.length > this.maxLength){ this.markInvalid(String.format(this.maxLengthText, this.maxLength)); return false; } if(this.vtype){ var vt = Ext.form.VTypes; if(!vt[this.vtype](value, this)){ this.markInvalid(this.vtypeText || vt[this.vtype +'Text']); return false; } } if(typeof this.validator == "function"){ var msg = this.validator(value); if(msg !== true){ this.markInvalid(msg); return false; } } if(this.regex && !this.regex.test(value)){ this.markInvalid(this.regexText); return false; } return true; }, selectText : function(start, end){ var v = this.getRawValue(); if(v.length > 0){ start = start === undefined ? 0 : start; end = end === undefined ? v.length : end; var d = this.el.dom; if(d.setSelectionRange){ d.setSelectionRange(start, end); }else if(d.createTextRange){ var range = d.createTextRange(); range.moveStart("character", start); range.moveEnd("character", end-v.length); range.select(); } } }, autoSize : function(){ if(!this.grow || !this.rendered){ return; } if(!this.metrics){ this.metrics = Ext.util.TextMetrics.createInstance(this.el); } var el = this.el; var v = el.dom.value; var d = document.createElement('div'); d.appendChild(document.createTextNode(v)); v = d.innerHTML; d = null; v += "&#160;"; var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) + 10, this.growMin)); this.el.setWidth(w); this.fireEvent("autosize", this, w); } }); Ext.reg('textfield', Ext.form.TextField); Ext.form.TriggerField = Ext.extend(Ext.form.TextField, { defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"}, hideTrigger:false, autoSize: Ext.emptyFn, monitorTab : true, deferHeight : true, mimicing : false, onResize : function(w, h){ Ext.form.TriggerField.superclass.onResize.call(this, w, h); if(typeof w == 'number'){ this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth())); } this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth()); }, adjustSize : Ext.BoxComponent.prototype.adjustSize, getResizeEl : function(){ return this.wrap; }, getPositionEl : function(){ return this.wrap; }, alignErrorIcon : function(){ this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); }, onRender : function(ct, position){ Ext.form.TriggerField.superclass.onRender.call(this, ct, position); this.wrap = this.el.wrap({cls: "x-form-field-wrap"}); this.trigger = this.wrap.createChild(this.triggerConfig || {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass}); if(this.hideTrigger){ this.trigger.setDisplayed(false); } this.initTrigger(); if(!this.width){ this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth()); } }, initTrigger : function(){ this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true}); this.trigger.addClassOnOver('x-form-trigger-over'); this.trigger.addClassOnClick('x-form-trigger-click'); }, onDestroy : function(){ if(this.trigger){ this.trigger.removeAllListeners(); this.trigger.remove(); } if(this.wrap){ this.wrap.remove(); } Ext.form.TriggerField.superclass.onDestroy.call(this); }, onFocus : function(){ Ext.form.TriggerField.superclass.onFocus.call(this); if(!this.mimicing){ this.wrap.addClass('x-trigger-wrap-focus'); this.mimicing = true; Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10}); if(this.monitorTab){ this.el.on("keydown", this.checkTab, this); } } }, checkTab : function(e){ if(e.getKey() == e.TAB){ this.triggerBlur(); } }, onBlur : function(){ }, mimicBlur : function(e){ if(!this.wrap.contains(e.target) && this.validateBlur(e)){ this.triggerBlur(); } }, triggerBlur : function(){ this.mimicing = false; Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur); if(this.monitorTab){ this.el.un("keydown", this.checkTab, this); } this.beforeBlur(); this.wrap.removeClass('x-trigger-wrap-focus'); Ext.form.TriggerField.superclass.onBlur.call(this); }, beforeBlur : Ext.emptyFn, validateBlur : function(e){ return true; }, onDisable : function(){ Ext.form.TriggerField.superclass.onDisable.call(this); if(this.wrap){ this.wrap.addClass('x-item-disabled'); } }, onEnable : function(){ Ext.form.TriggerField.superclass.onEnable.call(this); if(this.wrap){ this.wrap.removeClass('x-item-disabled'); } }, onShow : function(){ if(this.wrap){ this.wrap.dom.style.display = ''; this.wrap.dom.style.visibility = 'visible'; } }, onHide : function(){ this.wrap.dom.style.display = 'none'; }, onTriggerClick : Ext.emptyFn }); Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, { initComponent : function(){ Ext.form.TwinTriggerField.superclass.initComponent.call(this); this.triggerConfig = { tag:'span', cls:'x-form-twin-triggers', cn:[ {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class}, {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class} ]}; }, getTrigger : function(index){ return this.triggers[index]; }, initTrigger : function(){ var ts = this.trigger.select('.x-form-trigger', true); this.wrap.setStyle('overflow', 'hidden'); var triggerField = this; ts.each(function(t, all, index){ t.hide = function(){ var w = triggerField.wrap.getWidth(); this.dom.style.display = 'none'; triggerField.el.setWidth(w-triggerField.trigger.getWidth()); }; t.show = function(){ var w = triggerField.wrap.getWidth(); this.dom.style.display = ''; triggerField.el.setWidth(w-triggerField.trigger.getWidth()); }; var triggerIndex = 'Trigger'+(index+1); if(this['hide'+triggerIndex]){ t.dom.style.display = 'none'; } t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true}); t.addClassOnOver('x-form-trigger-over'); t.addClassOnClick('x-form-trigger-click'); }, this); this.triggers = ts.elements; }, onTrigger1Click : Ext.emptyFn, onTrigger2Click : Ext.emptyFn }); Ext.reg('trigger', Ext.form.TriggerField); Ext.form.TextArea = Ext.extend(Ext.form.TextField, { growMin : 60, growMax: 1000, growAppend : '&#160;\n&#160;', growPad : 0, enterIsSpecial : false, preventScrollbars: false, onRender : function(ct, position){ if(!this.el){ this.defaultAutoCreate = { tag: "textarea", style:"width:100px;height:60px;", autocomplete: "off" }; } Ext.form.TextArea.superclass.onRender.call(this, ct, position); if(this.grow){ this.textSizeEl = Ext.DomHelper.append(document.body, { tag: "pre", cls: "x-form-grow-sizer" }); if(this.preventScrollbars){ this.el.setStyle("overflow", "hidden"); } this.el.setHeight(this.growMin); } }, onDestroy : function(){ if(this.textSizeEl){ Ext.removeNode(this.textSizeEl); } Ext.form.TextArea.superclass.onDestroy.call(this); }, fireKey : function(e){ if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){ this.fireEvent("specialkey", this, e); } }, onKeyUp : function(e){ if(!e.isNavKeyPress() || e.getKey() == e.ENTER){ this.autoSize(); } }, autoSize : function(){ if(!this.grow || !this.textSizeEl){ return; } var el = this.el; var v = el.dom.value; var ts = this.textSizeEl; ts.innerHTML = ''; ts.appendChild(document.createTextNode(v)); v = ts.innerHTML; Ext.fly(ts).setWidth(this.el.getWidth()); if(v.length < 1){ v = "&#160;&#160;"; }else{ if(Ext.isIE){ v = v.replace(/\n/g, '<p>&#160;</p>'); } v += this.growAppend; } ts.innerHTML = v; var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad); if(h != this.lastHeight){ this.lastHeight = h; this.el.setHeight(h); this.fireEvent("autosize", this, h); } } }); Ext.reg('textarea', Ext.form.TextArea); Ext.form.NumberField = Ext.extend(Ext.form.TextField, { fieldClass: "x-form-field x-form-num-field", allowDecimals : true, decimalSeparator : ".", decimalPrecision : 2, allowNegative : true, minValue : Number.NEGATIVE_INFINITY, maxValue : Number.MAX_VALUE, minText : "The minimum value for this field is {0}", maxText : "The maximum value for this field is {0}", nanText : "{0} is not a valid number", baseChars : "0123456789", initEvents : function(){ Ext.form.NumberField.superclass.initEvents.call(this); var allowed = this.baseChars+''; if(this.allowDecimals){ allowed += this.decimalSeparator; } if(this.allowNegative){ allowed += "-"; } this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi'); var keyPress = function(e){ var k = e.getKey(); if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){ return; } var c = e.getCharCode(); if(allowed.indexOf(String.fromCharCode(c)) === -1){ e.stopEvent(); } }; this.el.on("keypress", keyPress, this); }, validateValue : function(value){ if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){ return false; } if(value.length < 1){ return true; } value = String(value).replace(this.decimalSeparator, "."); if(isNaN(value)){ this.markInvalid(String.format(this.nanText, value)); return false; } var num = this.parseValue(value); if(num < this.minValue){ this.markInvalid(String.format(this.minText, this.minValue)); return false; } if(num > this.maxValue){ this.markInvalid(String.format(this.maxText, this.maxValue)); return false; } return true; }, getValue : function(){ return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this))); }, setValue : function(v){ v = parseFloat(v); v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator); Ext.form.NumberField.superclass.setValue.call(this, v); }, parseValue : function(value){ value = parseFloat(String(value).replace(this.decimalSeparator, ".")); return isNaN(value) ? '' : value; }, fixPrecision : function(value){ var nan = isNaN(value); if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){ return nan ? '' : value; } return parseFloat(parseFloat(value).toFixed(this.decimalPrecision)); }, beforeBlur : function(){ var v = this.parseValue(this.getRawValue()); if(v){ this.setValue(this.fixPrecision(v)); } } }); Ext.reg('numberfield', Ext.form.NumberField); Ext.form.DateField = Ext.extend(Ext.form.TriggerField, { format : "m/d/y", altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d", disabledDays : null, disabledDaysText : "Disabled", disabledDates : null, disabledDatesText : "Disabled", minValue : null, maxValue : null, minText : "The date in this field must be equal to or after {0}", maxText : "The date in this field must be equal to or before {0}", invalidText : "{0} is not a valid date - it must be in the format {1}", triggerClass : 'x-form-date-trigger', defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"}, initComponent : function(){ Ext.form.DateField.superclass.initComponent.call(this); if(typeof this.minValue == "string"){ this.minValue = this.parseDate(this.minValue); } if(typeof this.maxValue == "string"){ this.maxValue = this.parseDate(this.maxValue); } this.ddMatch = null; if(this.disabledDates){ var dd = this.disabledDates; var re = "(?:"; for(var i = 0; i < dd.length; i++){ re += dd[i]; if(i != dd.length-1) re += "|"; } this.ddMatch = new RegExp(re + ")"); } }, validateValue : function(value){ value = this.formatDate(value); if(!Ext.form.DateField.superclass.validateValue.call(this, value)){ return false; } if(value.length < 1){ return true; } var svalue = value; value = this.parseDate(value); if(!value){ this.markInvalid(String.format(this.invalidText, svalue, this.format)); return false; } var time = value.getTime(); if(this.minValue && time < this.minValue.getTime()){ this.markInvalid(String.format(this.minText, this.formatDate(this.minValue))); return false; } if(this.maxValue && time > this.maxValue.getTime()){ this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue))); return false; } if(this.disabledDays){ var day = value.getDay(); for(var i = 0; i < this.disabledDays.length; i++) { if(day === this.disabledDays[i]){ this.markInvalid(this.disabledDaysText); return false; } } } var fvalue = this.formatDate(value); if(this.ddMatch && this.ddMatch.test(fvalue)){ this.markInvalid(String.format(this.disabledDatesText, fvalue)); return false; } return true; }, validateBlur : function(){ return !this.menu || !this.menu.isVisible(); }, getValue : function(){ return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || ""; }, setValue : function(date){ Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date))); }, parseDate : function(value){ if(!value || Ext.isDate(value)){ return value; } var v = Date.parseDate(value, this.format); if(!v && this.altFormats){ if(!this.altFormatsArray){ this.altFormatsArray = this.altFormats.split("|"); } for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){ v = Date.parseDate(value, this.altFormatsArray[i]); } } return v; }, onDestroy : function(){ if(this.menu) { this.menu.destroy(); } if(this.wrap){ this.wrap.remove(); } Ext.form.DateField.superclass.onDestroy.call(this); }, formatDate : function(date){ return Ext.isDate(date) ? date.dateFormat(this.format) : date; }, menuListeners : { select: function(m, d){ this.setValue(d); }, show : function(){ this.onFocus(); }, hide : function(){ this.focus.defer(10, this); var ml = this.menuListeners; this.menu.un("select", ml.select, this); this.menu.un("show", ml.show, this); this.menu.un("hide", ml.hide, this); } }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.DateMenu(); } Ext.apply(this.menu.picker, { minDate : this.minValue, maxDate : this.maxValue, disabledDatesRE : this.ddMatch, disabledDatesText : this.disabledDatesText, disabledDays : this.disabledDays, disabledDaysText : this.disabledDaysText, format : this.format, minText : String.format(this.minText, this.formatDate(this.minValue)), maxText : String.format(this.maxText, this.formatDate(this.maxValue)) }); this.menu.on(Ext.apply({}, this.menuListeners, { scope:this })); this.menu.picker.setValue(this.getValue() || new Date()); this.menu.show(this.el, "tl-bl?"); }, beforeBlur : function(){ var v = this.parseDate(this.getRawValue()); if(v){ this.setValue(v); } } }); Ext.reg('datefield', Ext.form.DateField); Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, { defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"}, listClass: '', selectedClass: 'x-combo-selected', triggerClass : 'x-form-arrow-trigger', shadow:'sides', listAlign: 'tl-bl?', maxHeight: 300, minHeight: 90, triggerAction: 'query', minChars : 4, typeAhead: false, queryDelay: 500, pageSize: 0, selectOnFocus:false, queryParam: 'query', loadingText: 'Loading...', resizable: false, handleHeight : 8, editable: true, allQuery: '', mode: 'remote', minListWidth : 70, forceSelection:false, typeAheadDelay : 250, lazyInit : true, initComponent : function(){ Ext.form.ComboBox.superclass.initComponent.call(this); this.addEvents( 'expand', 'collapse', 'beforeselect', 'select', 'beforequery' ); if(this.transform){ this.allowDomMove = false; var s = Ext.getDom(this.transform); if(!this.hiddenName){ this.hiddenName = s.name; } if(!this.store){ this.mode = 'local'; var d = [], opts = s.options; for(var i = 0, len = opts.length;i < len; i++){ var o = opts[i]; var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text; if(o.selected) { this.value = value; } d.push([value, o.text]); } this.store = new Ext.data.SimpleStore({ 'id': 0, fields: ['value', 'text'], data : d }); this.valueField = 'value'; this.displayField = 'text'; } s.name = Ext.id(); if(!this.lazyRender){ this.target = true; this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate); Ext.removeNode(s); this.render(this.el.parentNode); }else{ Ext.removeNode(s); } } this.selectedIndex = -1; if(this.mode == 'local'){ if(this.initialConfig.queryDelay === undefined){ this.queryDelay = 10; } if(this.initialConfig.minChars === undefined){ this.minChars = 0; } } }, onRender : function(ct, position){ Ext.form.ComboBox.superclass.onRender.call(this, ct, position); if(this.hiddenName){ this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)}, 'before', true); this.hiddenField.value = this.hiddenValue !== undefined ? this.hiddenValue : this.value !== undefined ? this.value : ''; this.el.dom.removeAttribute('name'); } if(Ext.isGecko){ this.el.dom.setAttribute('autocomplete', 'off'); } if(!this.lazyInit){ this.initList(); }else{ this.on('focus', this.initList, this, {single: true}); } if(!this.editable){ this.editable = true; this.setEditable(false); } }, initList : function(){ if(!this.list){ var cls = 'x-combo-list'; this.list = new Ext.Layer({ shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false }); var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth); this.list.setWidth(lw); this.list.swallowEvent('mousewheel'); this.assetHeight = 0; if(this.title){ this.header = this.list.createChild({cls:cls+'-hd', html: this.title}); this.assetHeight += this.header.getHeight(); } this.innerList = this.list.createChild({cls:cls+'-inner'}); this.innerList.on('mouseover', this.onViewOver, this); this.innerList.on('mousemove', this.onViewMove, this); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); if(this.pageSize){ this.footer = this.list.createChild({cls:cls+'-ft'}); this.pageTb = new Ext.PagingToolbar({ store:this.store, pageSize: this.pageSize, renderTo:this.footer }); this.assetHeight += this.footer.getHeight(); } if(!this.tpl){ this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>'; } this.view = new Ext.DataView({ applyTo: this.innerList, tpl: this.tpl, singleSelect: true, selectedClass: this.selectedClass, itemSelector: this.itemSelector || '.' + cls + '-item' }); this.view.on('click', this.onViewClick, this); this.bindStore(this.store, true); if(this.resizable){ this.resizer = new Ext.Resizable(this.list, { pinned:true, handles:'se' }); this.resizer.on('resize', function(r, w, h){ this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight; this.listWidth = w; this.innerList.setWidth(w - this.list.getFrameWidth('lr')); this.restrictHeight(); }, this); this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px'); } } }, bindStore : function(store, initial){ if(this.store && !initial){ this.store.un('beforeload', this.onBeforeLoad, this); this.store.un('load', this.onLoad, this); this.store.un('loadexception', this.collapse, this); if(!store){ this.store = null; if(this.view){ this.view.setStore(null); } } } if(store){ this.store = Ext.StoreMgr.lookup(store); this.store.on('beforeload', this.onBeforeLoad, this); this.store.on('load', this.onLoad, this); this.store.on('loadexception', this.collapse, this); if(this.view){ this.view.setStore(store); } } }, initEvents : function(){ Ext.form.ComboBox.superclass.initEvents.call(this); this.keyNav = new Ext.KeyNav(this.el, { "up" : function(e){ this.inKeyMode = true; this.selectPrev(); }, "down" : function(e){ if(!this.isExpanded()){ this.onTriggerClick(); }else{ this.inKeyMode = true; this.selectNext(); } }, "enter" : function(e){ this.onViewClick(); this.delayedCheck = true; this.unsetDelayCheck.defer(10, this); }, "esc" : function(e){ this.collapse(); }, "tab" : function(e){ this.onViewClick(false); return true; }, scope : this, doRelay : function(foo, bar, hname){ if(hname == 'down' || this.scope.isExpanded()){ return Ext.KeyNav.prototype.doRelay.apply(this, arguments); } return true; }, forceKeyDown : true }); this.queryDelay = Math.max(this.queryDelay || 10, this.mode == 'local' ? 10 : 250); this.dqTask = new Ext.util.DelayedTask(this.initQuery, this); if(this.typeAhead){ this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this); } if(this.editable !== false){ this.el.on("keyup", this.onKeyUp, this); } if(this.forceSelection){ this.on('blur', this.doForce, this); } }, onDestroy : function(){ if(this.view){ this.view.el.removeAllListeners(); this.view.el.remove(); this.view.purgeListeners(); } if(this.list){ this.list.destroy(); } this.bindStore(null); Ext.form.ComboBox.superclass.onDestroy.call(this); }, unsetDelayCheck : function(){ delete this.delayedCheck; }, fireKey : function(e){ if(e.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck){ this.fireEvent("specialkey", this, e); } }, onResize: function(w, h){ Ext.form.ComboBox.superclass.onResize.apply(this, arguments); if(this.list && this.listWidth === undefined){ var lw = Math.max(w, this.minListWidth); this.list.setWidth(lw); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); } }, onEnable: function(){ Ext.form.ComboBox.superclass.onEnable.apply(this, arguments); if(this.hiddenField){ this.hiddenField.disabled = false; } }, onDisable: function(){ Ext.form.ComboBox.superclass.onDisable.apply(this, arguments); if(this.hiddenField){ this.hiddenField.disabled = true; } }, setEditable : function(value){ if(value == this.editable){ return; } this.editable = value; if(!value){ this.el.dom.setAttribute('readOnly', true); this.el.on('mousedown', this.onTriggerClick, this); this.el.addClass('x-combo-noedit'); }else{ this.el.dom.setAttribute('readOnly', false); this.el.un('mousedown', this.onTriggerClick, this); this.el.removeClass('x-combo-noedit'); } }, onBeforeLoad : function(){ if(!this.hasFocus){ return; } this.innerList.update(this.loadingText ? '<div class="loading-indicator">'+this.loadingText+'</div>' : ''); this.restrictHeight(); this.selectedIndex = -1; }, onLoad : function(){ if(!this.hasFocus){ return; } if(this.store.getCount() > 0){ this.expand(); this.restrictHeight(); if(this.lastQuery == this.allQuery){ if(this.editable){ this.el.dom.select(); } if(!this.selectByValue(this.value, true)){ this.select(0, true); } }else{ this.selectNext(); if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){ this.taTask.delay(this.typeAheadDelay); } } }else{ this.onEmptyResults(); } }, onTypeAhead : function(){ if(this.store.getCount() > 0){ var r = this.store.getAt(0); var newValue = r.data[this.displayField]; var len = newValue.length; var selStart = this.getRawValue().length; if(selStart != len){ this.setRawValue(newValue); this.selectText(selStart, newValue.length); } } }, onSelect : function(record, index){ if(this.fireEvent('beforeselect', this, record, index) !== false){ this.setValue(record.data[this.valueField || this.displayField]); this.collapse(); this.fireEvent('select', this, record, index); } }, getValue : function(){ if(this.valueField){ return typeof this.value != 'undefined' ? this.value : ''; }else{ return Ext.form.ComboBox.superclass.getValue.call(this); } }, clearValue : function(){ if(this.hiddenField){ this.hiddenField.value = ''; } this.setRawValue(''); this.lastSelectionText = ''; this.applyEmptyText(); this.value = ''; }, setValue : function(v){ var text = v; if(this.valueField){ var r = this.findRecord(this.valueField, v); if(r){ text = r.data[this.displayField]; }else if(this.valueNotFoundText !== undefined){ text = this.valueNotFoundText; } } this.lastSelectionText = text; if(this.hiddenField){ this.hiddenField.value = v; } Ext.form.ComboBox.superclass.setValue.call(this, text); this.value = v; }, findRecord : function(prop, value){ var record; if(this.store.getCount() > 0){ this.store.each(function(r){ if(r.data[prop] == value){ record = r; return false; } }); } return record; }, onViewMove : function(e, t){ this.inKeyMode = false; }, onViewOver : function(e, t){ if(this.inKeyMode){ return; } var item = this.view.findItemFromChild(t); if(item){ var index = this.view.indexOf(item); this.select(index, false); } }, onViewClick : function(doFocus){ var index = this.view.getSelectedIndexes()[0]; var r = this.store.getAt(index); if(r){ this.onSelect(r, index); } if(doFocus !== false){ this.el.focus(); } }, restrictHeight : function(){ this.innerList.dom.style.height = ''; var inner = this.innerList.dom; var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight; var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight); var ha = this.getPosition()[1]-Ext.getBody().getScroll().top; var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height; var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadow.offset-pad-2; h = Math.min(h, space, this.maxHeight); this.innerList.setHeight(h); this.list.beginUpdate(); this.list.setHeight(h+pad); this.list.alignTo(this.el, this.listAlign); this.list.endUpdate(); }, onEmptyResults : function(){ this.collapse(); }, isExpanded : function(){ return this.list && this.list.isVisible(); }, selectByValue : function(v, scrollIntoView){ if(v !== undefined && v !== null){ var r = this.findRecord(this.valueField || this.displayField, v); if(r){ this.select(this.store.indexOf(r), scrollIntoView); return true; } } return false; }, select : function(index, scrollIntoView){ this.selectedIndex = index; this.view.select(index); if(scrollIntoView !== false){ var el = this.view.getNode(index); if(el){ this.innerList.scrollChildIntoView(el, false); } } }, selectNext : function(){ var ct = this.store.getCount(); if(ct > 0){ if(this.selectedIndex == -1){ this.select(0); }else if(this.selectedIndex < ct-1){ this.select(this.selectedIndex+1); } } }, selectPrev : function(){ var ct = this.store.getCount(); if(ct > 0){ if(this.selectedIndex == -1){ this.select(0); }else if(this.selectedIndex != 0){ this.select(this.selectedIndex-1); } } }, onKeyUp : function(e){ if(this.editable !== false && !e.isSpecialKey()){ this.lastKey = e.getKey(); this.dqTask.delay(this.queryDelay); } }, validateBlur : function(){ return !this.list || !this.list.isVisible(); }, initQuery : function(){ this.doQuery(this.getRawValue()); }, doForce : function(){ if(this.el.dom.value.length > 0){ this.el.dom.value = this.lastSelectionText === undefined ? '' : this.lastSelectionText; this.applyEmptyText(); } }, doQuery : function(q, forceAll){ if(q === undefined || q === null){ q = ''; } var qe = { query: q, forceAll: forceAll, combo: this, cancel:false }; if(this.fireEvent('beforequery', qe)===false || qe.cancel){ return false; } q = qe.query; forceAll = qe.forceAll; if(forceAll === true || (q.length >= this.minChars)){ if(this.lastQuery !== q){ this.lastQuery = q; if(this.mode == 'local'){ this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); }else{ this.store.filter(this.displayField, q); } this.onLoad(); }else{ this.store.baseParams[this.queryParam] = q; this.store.load({ params: this.getParams(q) }); this.expand(); } }else{ this.selectedIndex = -1; this.onLoad(); } } }, getParams : function(q){ var p = {}; if(this.pageSize){ p.start = 0; p.limit = this.pageSize; } return p; }, collapse : function(){ if(!this.isExpanded()){ return; } this.list.hide(); Ext.getDoc().un('mousewheel', this.collapseIf, this); Ext.getDoc().un('mousedown', this.collapseIf, this); this.fireEvent('collapse', this); }, collapseIf : function(e){ if(!e.within(this.wrap) && !e.within(this.list)){ this.collapse(); } }, expand : function(){ if(this.isExpanded() || !this.hasFocus){ return; } this.list.alignTo(this.wrap, this.listAlign); this.list.show(); this.innerList.setOverflow('auto'); Ext.getDoc().on('mousewheel', this.collapseIf, this); Ext.getDoc().on('mousedown', this.collapseIf, this); this.fireEvent('expand', this); }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.isExpanded()){ this.collapse(); this.el.focus(); }else { this.onFocus({}); if(this.triggerAction == 'all') { this.doQuery(this.allQuery, true); } else { this.doQuery(this.getRawValue()); } this.el.focus(); } } }); Ext.reg('combo', Ext.form.ComboBox); Ext.form.Checkbox = Ext.extend(Ext.form.Field, { focusClass : undefined, fieldClass: "x-form-field", checked: false, defaultAutoCreate : { tag: "input", type: 'checkbox', autocomplete: "off"}, initComponent : function(){ Ext.form.Checkbox.superclass.initComponent.call(this); this.addEvents( 'check' ); }, onResize : function(){ Ext.form.Checkbox.superclass.onResize.apply(this, arguments); if(!this.boxLabel){ this.el.alignTo(this.wrap, 'c-c'); } }, initEvents : function(){ Ext.form.Checkbox.superclass.initEvents.call(this); this.el.on("click", this.onClick, this); this.el.on("change", this.onClick, this); }, getResizeEl : function(){ return this.wrap; }, getPositionEl : function(){ return this.wrap; }, markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn, onRender : function(ct, position){ Ext.form.Checkbox.superclass.onRender.call(this, ct, position); if(this.inputValue !== undefined){ this.el.dom.value = this.inputValue; } this.wrap = this.el.wrap({cls: "x-form-check-wrap"}); if(this.boxLabel){ this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel}); } if(this.checked){ this.setValue(true); }else{ this.checked = this.el.dom.checked; } }, onDestroy : function(){ if(this.wrap){ this.wrap.remove(); } Ext.form.Checkbox.superclass.onDestroy.call(this); }, initValue : Ext.emptyFn, getValue : function(){ if(this.rendered){ return this.el.dom.checked; } return false; }, onClick : function(){ if(this.el.dom.checked != this.checked){ this.setValue(this.el.dom.checked); } }, setValue : function(v){ this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on'); if(this.el && this.el.dom){ this.el.dom.checked = this.checked; this.el.dom.defaultChecked = this.checked; } this.fireEvent("check", this, this.checked); } }); Ext.reg('checkbox', Ext.form.Checkbox); Ext.form.Radio = Ext.extend(Ext.form.Checkbox, { inputType: 'radio', markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn, getGroupValue : function(){ var p = this.el.up('form') || Ext.getBody(); var c = p.child('input[name='+this.el.dom.name+']:checked', true); return c ? c.value : null; }, onClick : function(){ if(this.el.dom.checked != this.checked){ var p = this.el.up('form') || Ext.getBody(); var els = p.select('input[name='+this.el.dom.name+']'); els.each(function(el){ if(el.dom.id == this.id){ this.setValue(true); }else{ Ext.getCmp(el.dom.id).setValue(false); } }, this); } }, setValue : function(v){ if (typeof v == 'boolean') { Ext.form.Radio.superclass.setValue.call(this, v); } else { var r = this.el.up('form').child('input[name='+this.el.dom.name+'][value='+v+']', true); if (r){ r.checked = true; }; } } }); Ext.reg('radio', Ext.form.Radio); Ext.form.Hidden = Ext.extend(Ext.form.Field, { inputType : 'hidden', onRender : function(){ Ext.form.Hidden.superclass.onRender.apply(this, arguments); }, initEvents : function(){ this.originalValue = this.getValue(); }, setSize : Ext.emptyFn, setWidth : Ext.emptyFn, setHeight : Ext.emptyFn, setPosition : Ext.emptyFn, setPagePosition : Ext.emptyFn, markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn }); Ext.reg('hidden', Ext.form.Hidden); Ext.form.BasicForm = function(el, config){ Ext.apply(this, config); this.items = new Ext.util.MixedCollection(false, function(o){ return o.id || (o.id = Ext.id()); }); this.addEvents( 'beforeaction', 'actionfailed', 'actioncomplete' ); if(el){ this.initEl(el); } Ext.form.BasicForm.superclass.constructor.call(this); }; Ext.extend(Ext.form.BasicForm, Ext.util.Observable, { timeout: 30, activeAction : null, trackResetOnLoad : false, initEl : function(el){ this.el = Ext.get(el); this.id = this.el.id || Ext.id(); if(!this.standardSubmit){ this.el.on('submit', this.onSubmit, this); } this.el.addClass('x-form'); }, getEl: function(){ return this.el; }, onSubmit : function(e){ e.stopEvent(); }, destroy: function() { this.items.each(function(f){ Ext.destroy(f); }); if(this.el){ this.el.removeAllListeners(); this.el.remove(); } this.purgeListeners(); }, isValid : function(){ var valid = true; this.items.each(function(f){ if(!f.validate()){ valid = false; } }); return valid; }, isDirty : function(){ var dirty = false; this.items.each(function(f){ if(f.isDirty()){ dirty = true; return false; } }); return dirty; }, doAction : function(action, options){ if(typeof action == 'string'){ action = new Ext.form.Action.ACTION_TYPES[action](this, options); } if(this.fireEvent('beforeaction', this, action) !== false){ this.beforeAction(action); action.run.defer(100, action); } return this; }, submit : function(options){ if(this.standardSubmit){ var v = this.isValid(); if(v){ this.el.dom.submit(); } return v; } this.doAction('submit', options); return this; }, load : function(options){ this.doAction('load', options); return this; }, updateRecord : function(record){ record.beginEdit(); var fs = record.fields; fs.each(function(f){ var field = this.findField(f.name); if(field){ record.set(f.name, field.getValue()); } }, this); record.endEdit(); return this; }, loadRecord : function(record){ this.setValues(record.data); return this; }, beforeAction : function(action){ var o = action.options; if(o.waitMsg){ if(this.waitMsgTarget === true){ this.el.mask(o.waitMsg, 'x-mask-loading'); }else if(this.waitMsgTarget){ this.waitMsgTarget = Ext.get(this.waitMsgTarget); this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading'); }else{ Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...'); } } }, afterAction : function(action, success){ this.activeAction = null; var o = action.options; if(o.waitMsg){ if(this.waitMsgTarget === true){ this.el.unmask(); }else if(this.waitMsgTarget){ this.waitMsgTarget.unmask(); }else{ Ext.MessageBox.updateProgress(1); Ext.MessageBox.hide(); } } if(success){ if(o.reset){ this.reset(); } Ext.callback(o.success, o.scope, [this, action]); this.fireEvent('actioncomplete', this, action); }else{ Ext.callback(o.failure, o.scope, [this, action]); this.fireEvent('actionfailed', this, action); } }, findField : function(id){ var field = this.items.get(id); if(!field){ this.items.each(function(f){ if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){ field = f; return false; } }); } return field || null; }, markInvalid : function(errors){ if(Ext.isArray(errors)){ for(var i = 0, len = errors.length; i < len; i++){ var fieldError = errors[i]; var f = this.findField(fieldError.id); if(f){ f.markInvalid(fieldError.msg); } } }else{ var field, id; for(id in errors){ if(typeof errors[id] != 'function' && (field = this.findField(id))){ field.markInvalid(errors[id]); } } } return this; }, setValues : function(values){ if(Ext.isArray(values)){ for(var i = 0, len = values.length; i < len; i++){ var v = values[i]; var f = this.findField(v.id); if(f){ f.setValue(v.value); if(this.trackResetOnLoad){ f.originalValue = f.getValue(); } } } }else{ var field, id; for(id in values){ if(typeof values[id] != 'function' && (field = this.findField(id))){ field.setValue(values[id]); if(this.trackResetOnLoad){ field.originalValue = field.getValue(); } } } } return this; }, getValues : function(asString){ var fs = Ext.lib.Ajax.serializeForm(this.el.dom); if(asString === true){ return fs; } return Ext.urlDecode(fs); }, clearInvalid : function(){ this.items.each(function(f){ f.clearInvalid(); }); return this; }, reset : function(){ this.items.each(function(f){ f.reset(); }); return this; }, add : function(){ this.items.addAll(Array.prototype.slice.call(arguments, 0)); return this; }, remove : function(field){ this.items.remove(field); return this; }, render : function(){ this.items.each(function(f){ if(f.isFormField && !f.rendered && document.getElementById(f.id)){ f.applyToMarkup(f.id); } }); return this; }, applyToFields : function(o){ this.items.each(function(f){ Ext.apply(f, o); }); return this; }, applyIfToFields : function(o){ this.items.each(function(f){ Ext.applyIf(f, o); }); return this; } }); Ext.BasicForm = Ext.form.BasicForm; Ext.FormPanel = Ext.extend(Ext.Panel, { buttonAlign:'center', minButtonWidth:75, labelAlign:'left', monitorValid : false, monitorPoll : 200, layout: 'form', initComponent :function(){ this.form = this.createForm(); Ext.FormPanel.superclass.initComponent.call(this); this.addEvents( 'clientvalidation' ); this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']); }, createForm: function(){ delete this.initialConfig.listeners; return new Ext.form.BasicForm(null, this.initialConfig); }, initFields : function(){ var f = this.form; var formPanel = this; var fn = function(c){ if(c.doLayout && c != formPanel){ Ext.applyIf(c, { labelAlign: c.ownerCt.labelAlign, labelWidth: c.ownerCt.labelWidth, itemCls: c.ownerCt.itemCls }); if(c.items){ c.items.each(fn); } }else if(c.isFormField){ f.add(c); } } this.items.each(fn); }, getLayoutTarget : function(){ return this.form.el; }, getForm : function(){ return this.form; }, onRender : function(ct, position){ this.initFields(); Ext.FormPanel.superclass.onRender.call(this, ct, position); var o = { tag: 'form', method : this.method || 'POST', id : this.formId || Ext.id() }; if(this.fileUpload) { o.enctype = 'multipart/form-data'; } this.form.initEl(this.body.createChild(o)); }, beforeDestroy: function(){ Ext.FormPanel.superclass.beforeDestroy.call(this); Ext.destroy(this.form); }, initEvents : function(){ Ext.FormPanel.superclass.initEvents.call(this); this.items.on('remove', this.onRemove, this); this.items.on('add', this.onAdd, this); if(this.monitorValid){ this.startMonitoring(); } }, onAdd : function(ct, c) { if (c.isFormField) { this.form.add(c); } }, onRemove : function(c) { if (c.isFormField) { Ext.destroy(c.container.up('.x-form-item')); this.form.remove(c); } }, startMonitoring : function(){ if(!this.bound){ this.bound = true; Ext.TaskMgr.start({ run : this.bindHandler, interval : this.monitorPoll || 200, scope: this }); } }, stopMonitoring : function(){ this.bound = false; }, load : function(){ this.form.load.apply(this.form, arguments); }, onDisable : function(){ Ext.FormPanel.superclass.onDisable.call(this); if(this.form){ this.form.items.each(function(){ this.disable(); }); } }, onEnable : function(){ Ext.FormPanel.superclass.onEnable.call(this); if(this.form){ this.form.items.each(function(){ this.enable(); }); } }, bindHandler : function(){ if(!this.bound){ return false; } var valid = true; this.form.items.each(function(f){ if(!f.isValid(true)){ valid = false; return false; } }); if(this.buttons){ for(var i = 0, len = this.buttons.length; i < len; i++){ var btn = this.buttons[i]; if(btn.formBind === true && btn.disabled === valid){ btn.setDisabled(!valid); } } } this.fireEvent('clientvalidation', this, valid); } }); Ext.reg('form', Ext.FormPanel); Ext.form.FormPanel = Ext.FormPanel; Ext.form.FieldSet = Ext.extend(Ext.Panel, { baseCls:'x-fieldset', layout: 'form', onRender : function(ct, position){ if(!this.el){ this.el = document.createElement('fieldset'); this.el.id = this.id; if (this.title || this.header || this.checkboxToggle) { this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header'; } } Ext.form.FieldSet.superclass.onRender.call(this, ct, position); if(this.checkboxToggle){ var o = typeof this.checkboxToggle == 'object' ? this.checkboxToggle : {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'}; this.checkbox = this.header.insertFirst(o); this.checkbox.dom.checked = !this.collapsed; this.checkbox.on('click', this.onCheckClick, this); } }, onCollapse : function(doAnim, animArg){ if(this.checkbox){ this.checkbox.dom.checked = false; } this.afterCollapse(); }, onExpand : function(doAnim, animArg){ if(this.checkbox){ this.checkbox.dom.checked = true; } this.afterExpand(); }, onCheckClick : function(){ this[this.checkbox.dom.checked ? 'expand' : 'collapse'](); } }); Ext.reg('fieldset', Ext.form.FieldSet); Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { enableFormat : true, enableFontSize : true, enableColors : true, enableAlignments : true, enableLists : true, enableSourceEdit : true, enableLinks : true, enableFont : true, createLinkText : 'Please enter the URL for the link:', defaultLinkValue : 'http:/'+'/', fontFamilies : [ 'Arial', 'Courier New', 'Tahoma', 'Times New Roman', 'Verdana' ], defaultFont: 'tahoma', validationEvent : false, deferHeight: true, initialized : false, activated : false, sourceEditMode : false, onFocus : Ext.emptyFn, iframePad:3, hideMode:'offsets', defaultAutoCreate : { tag: "textarea", style:"width:500px;height:300px;", autocomplete: "off" }, initComponent : function(){ this.addEvents( 'initialize', 'activate', 'beforesync', 'beforepush', 'sync', 'push', 'editmodechange' ) }, createFontOptions : function(){ var buf = [], fs = this.fontFamilies, ff, lc; for(var i = 0, len = fs.length; i< len; i++){ ff = fs[i]; lc = ff.toLowerCase(); buf.push( '<option value="',lc,'" style="font-family:',ff,';"', (this.defaultFont == lc ? ' selected="true">' : '>'), ff, '</option>' ); } return buf.join(''); }, createToolbar : function(editor){ function btn(id, toggle, handler){ return { itemId : id, cls : 'x-btn-icon x-edit-'+id, enableToggle:toggle !== false, scope: editor, handler:handler||editor.relayBtnCmd, clickEvent:'mousedown', tooltip: editor.buttonTips[id] || undefined, tabIndex:-1 }; } var tb = new Ext.Toolbar({ renderTo:this.wrap.dom.firstChild }); tb.el.on('click', function(e){ e.preventDefault(); }); if(this.enableFont && !Ext.isSafari){ this.fontSelect = tb.el.createChild({ tag:'select', cls:'x-font-select', html: this.createFontOptions() }); this.fontSelect.on('change', function(){ var font = this.fontSelect.dom.value; this.relayCmd('fontname', font); this.deferFocus(); }, this); tb.add( this.fontSelect.dom, '-' ); }; if(this.enableFormat){ tb.add( btn('bold'), btn('italic'), btn('underline') ); }; if(this.enableFontSize){ tb.add( '-', btn('increasefontsize', false, this.adjustFont), btn('decreasefontsize', false, this.adjustFont) ); }; if(this.enableColors){ tb.add( '-', { itemId:'forecolor', cls:'x-btn-icon x-edit-forecolor', clickEvent:'mousedown', tooltip: editor.buttonTips['forecolor'] || undefined, tabIndex:-1, menu : new Ext.menu.ColorMenu({ allowReselect: true, focus: Ext.emptyFn, value:'000000', plain:true, selectHandler: function(cp, color){ this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color); this.deferFocus(); }, scope: this, clickEvent:'mousedown' }) }, { itemId:'backcolor', cls:'x-btn-icon x-edit-backcolor', clickEvent:'mousedown', tooltip: editor.buttonTips['backcolor'] || undefined, tabIndex:-1, menu : new Ext.menu.ColorMenu({ focus: Ext.emptyFn, value:'FFFFFF', plain:true, allowReselect: true, selectHandler: function(cp, color){ if(Ext.isGecko){ this.execCmd('useCSS', false); this.execCmd('hilitecolor', color); this.execCmd('useCSS', true); this.deferFocus(); }else{ this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color); this.deferFocus(); } }, scope:this, clickEvent:'mousedown' }) } ); }; if(this.enableAlignments){ tb.add( '-', btn('justifyleft'), btn('justifycenter'), btn('justifyright') ); }; if(!Ext.isSafari){ if(this.enableLinks){ tb.add( '-', btn('createlink', false, this.createLink) ); }; if(this.enableLists){ tb.add( '-', btn('insertorderedlist'), btn('insertunorderedlist') ); } if(this.enableSourceEdit){ tb.add( '-', btn('sourceedit', true, function(btn){ this.toggleSourceEdit(btn.pressed); }) ); } } this.tb = tb; }, getDocMarkup : function(){ return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>'; }, getEditorBody : function(){ return this.doc.body || this.doc.documentElement; }, onRender : function(ct, position){ Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position); this.el.dom.style.border = '0 none'; this.el.dom.setAttribute('tabIndex', -1); this.el.addClass('x-hidden'); if(Ext.isIE){ this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;') } this.wrap = this.el.wrap({ cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'} }); this.createToolbar(this); this.tb.items.each(function(item){ if(item.itemId != 'sourceedit'){ item.disable(); } }); var iframe = document.createElement('iframe'); iframe.name = Ext.id(); iframe.frameBorder = 'no'; iframe.src=(Ext.SSL_SECURE_URL || "javascript:false"); this.wrap.dom.appendChild(iframe); this.iframe = iframe; if(Ext.isIE){ iframe.contentWindow.document.designMode = 'on'; this.doc = iframe.contentWindow.document; this.win = iframe.contentWindow; } else { this.doc = (iframe.contentDocument || window.frames[iframe.name].document); this.win = window.frames[iframe.name]; this.doc.designMode = 'on'; } this.doc.open(); this.doc.write(this.getDocMarkup()) this.doc.close(); var task = { run : function(){ if(this.doc.body || this.doc.readyState == 'complete'){ Ext.TaskMgr.stop(task); this.doc.designMode="on"; this.initEditor.defer(10, this); } }, interval : 10, duration:10000, scope: this }; Ext.TaskMgr.start(task); if(!this.width){ this.setSize(this.el.getSize()); } }, onResize : function(w, h){ Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments); if(this.el && this.iframe){ if(typeof w == 'number'){ var aw = w - this.wrap.getFrameWidth('lr'); this.el.setWidth(this.adjustWidth('textarea', aw)); this.iframe.style.width = aw + 'px'; } if(typeof h == 'number'){ var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight(); this.el.setHeight(this.adjustWidth('textarea', ah)); this.iframe.style.height = ah + 'px'; if(this.doc){ this.getEditorBody().style.height = (ah - (this.iframePad*2)) + 'px'; } } } }, toggleSourceEdit : function(sourceEditMode){ if(sourceEditMode === undefined){ sourceEditMode = !this.sourceEditMode; } this.sourceEditMode = sourceEditMode === true; var btn = this.tb.items.get('sourceedit'); if(btn.pressed !== this.sourceEditMode){ btn.toggle(this.sourceEditMode); return; } if(this.sourceEditMode){ this.tb.items.each(function(item){ if(item.itemId != 'sourceedit'){ item.disable(); } }); this.syncValue(); this.iframe.className = 'x-hidden'; this.el.removeClass('x-hidden'); this.el.dom.removeAttribute('tabIndex'); this.el.focus(); }else{ if(this.initialized){ this.tb.items.each(function(item){ item.enable(); }); } this.pushValue(); this.iframe.className = ''; this.el.addClass('x-hidden'); this.el.dom.setAttribute('tabIndex', -1); this.deferFocus(); } var lastSize = this.lastSize; if(lastSize){ delete this.lastSize; this.setSize(lastSize); } this.fireEvent('editmodechange', this, this.sourceEditMode); }, createLink : function(){ var url = prompt(this.createLinkText, this.defaultLinkValue); if(url && url != 'http:/'+'/'){ this.relayCmd('createlink', url); } }, adjustSize : Ext.BoxComponent.prototype.adjustSize, getResizeEl : function(){ return this.wrap; }, getPositionEl : function(){ return this.wrap; }, initEvents : function(){ this.originalValue = this.getValue(); }, markInvalid : Ext.emptyFn, clearInvalid : Ext.emptyFn, setValue : function(v){ Ext.form.HtmlEditor.superclass.setValue.call(this, v); this.pushValue(); }, cleanHtml : function(html){ html = String(html); if(html.length > 5){ if(Ext.isSafari){ html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, ''); } } if(html == '&nbsp;'){ html = ''; } return html; }, syncValue : function(){ if(this.initialized){ var bd = this.getEditorBody(); var html = bd.innerHTML; if(Ext.isSafari){ var bs = bd.getAttribute('style'); var m = bs.match(/text-align:(.*?);/i); if(m && m[1]){ html = '<div style="'+m[0]+'">' + html + '</div>'; } } html = this.cleanHtml(html); if(this.fireEvent('beforesync', this, html) !== false){ this.el.dom.value = html; this.fireEvent('sync', this, html); } } }, pushValue : function(){ if(this.initialized){ var v = this.el.dom.value; if(!this.activated && v.length < 1){ v = '&nbsp;'; } if(this.fireEvent('beforepush', this, v) !== false){ this.getEditorBody().innerHTML = v; this.fireEvent('push', this, v); } } }, deferFocus : function(){ this.focus.defer(10, this); }, focus : function(){ if(this.win && !this.sourceEditMode){ this.win.focus(); }else{ this.el.focus(); } }, initEditor : function(){ var dbody = this.getEditorBody(); var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat'); ss['background-attachment'] = 'fixed'; dbody.bgProperties = 'fixed'; Ext.DomHelper.applyStyles(dbody, ss); Ext.EventManager.on(this.doc, { 'mousedown': this.onEditorEvent, 'dblclick': this.onEditorEvent, 'click': this.onEditorEvent, 'keyup': this.onEditorEvent, buffer:100, scope: this }); if(Ext.isGecko){ Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this); } if(Ext.isIE || Ext.isSafari || Ext.isOpera){ Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this); } this.initialized = true; this.fireEvent('initialize', this); this.pushValue(); }, onDestroy : function(){ if(this.rendered){ this.tb.items.each(function(item){ if(item.menu){ item.menu.removeAll(); if(item.menu.el){ item.menu.el.destroy(); } } item.destroy(); }); this.wrap.dom.innerHTML = ''; this.wrap.remove(); } }, onFirstFocus : function(){ this.activated = true; this.tb.items.each(function(item){ item.enable(); }); if(Ext.isGecko){ this.win.focus(); var s = this.win.getSelection(); if(!s.focusNode || s.focusNode.nodeType != 3){ var r = s.getRangeAt(0); r.selectNodeContents(this.getEditorBody()); r.collapse(true); this.deferFocus(); } try{ this.execCmd('useCSS', true); this.execCmd('styleWithCSS', false); }catch(e){} } this.fireEvent('activate', this); }, adjustFont: function(btn){ var adjust = btn.itemId == 'increasefontsize' ? 1 : -1; var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10); if(Ext.isSafari3 || Ext.isAir){ if(v <= 10){ v = 1 + adjust; }else if(v <= 13){ v = 2 + adjust; }else if(v <= 16){ v = 3 + adjust; }else if(v <= 18){ v = 4 + adjust; }else if(v <= 24){ v = 5 + adjust; }else { v = 6 + adjust; } v = v.constrain(1, 6); }else{ if(Ext.isSafari){ adjust *= 2; } v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0); } this.execCmd('FontSize', v); }, onEditorEvent : function(e){ this.updateToolbar(); }, updateToolbar: function(){ if(!this.activated){ this.onFirstFocus(); return; } var btns = this.tb.items.map, doc = this.doc; if(this.enableFont && !Ext.isSafari){ var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase(); if(name != this.fontSelect.dom.value){ this.fontSelect.dom.value = name; } } if(this.enableFormat){ btns.bold.toggle(doc.queryCommandState('bold')); btns.italic.toggle(doc.queryCommandState('italic')); btns.underline.toggle(doc.queryCommandState('underline')); } if(this.enableAlignments){ btns.justifyleft.toggle(doc.queryCommandState('justifyleft')); btns.justifycenter.toggle(doc.queryCommandState('justifycenter')); btns.justifyright.toggle(doc.queryCommandState('justifyright')); } if(!Ext.isSafari && this.enableLists){ btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist')); btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist')); } Ext.menu.MenuMgr.hideAll(); this.syncValue(); }, relayBtnCmd : function(btn){ this.relayCmd(btn.itemId); }, relayCmd : function(cmd, value){ this.win.focus(); this.execCmd(cmd, value); this.updateToolbar(); this.deferFocus(); }, execCmd : function(cmd, value){ this.doc.execCommand(cmd, false, value === undefined ? null : value); this.syncValue(); }, applyCommand : function(e){ if(e.ctrlKey){ var c = e.getCharCode(), cmd; if(c > 0){ c = String.fromCharCode(c); switch(c){ case 'b': cmd = 'bold'; break; case 'i': cmd = 'italic'; break; case 'u': cmd = 'underline'; break; } if(cmd){ this.win.focus(); this.execCmd(cmd); this.deferFocus(); e.preventDefault(); } } } }, insertAtCursor : function(text){ if(!this.activated){ return; } if(Ext.isIE){ this.win.focus(); var r = this.doc.selection.createRange(); if(r){ r.collapse(true); r.pasteHTML(text); this.syncValue(); this.deferFocus(); } }else if(Ext.isGecko || Ext.isOpera){ this.win.focus(); this.execCmd('InsertHTML', text); this.deferFocus(); }else if(Ext.isSafari){ this.execCmd('InsertText', text); this.deferFocus(); } }, fixKeys : function(){ if(Ext.isIE){ return function(e){ var k = e.getKey(), r; if(k == e.TAB){ e.stopEvent(); r = this.doc.selection.createRange(); if(r){ r.collapse(true); r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;'); this.deferFocus(); } }else if(k == e.ENTER){ r = this.doc.selection.createRange(); if(r){ var target = r.parentElement(); if(!target || target.tagName.toLowerCase() != 'li'){ e.stopEvent(); r.pasteHTML('<br />'); r.collapse(false); r.select(); } } } }; }else if(Ext.isOpera){ return function(e){ var k = e.getKey(); if(k == e.TAB){ e.stopEvent(); this.win.focus(); this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;'); this.deferFocus(); } }; }else if(Ext.isSafari){ return function(e){ var k = e.getKey(); if(k == e.TAB){ e.stopEvent(); this.execCmd('InsertText','\t'); this.deferFocus(); } }; } }(), getToolbar : function(){ return this.tb; }, buttonTips : { bold : { title: 'Bold (Ctrl+B)', text: 'Make the selected text bold.', cls: 'x-html-editor-tip' }, italic : { title: 'Italic (Ctrl+I)', text: 'Make the selected text italic.', cls: 'x-html-editor-tip' }, underline : { title: 'Underline (Ctrl+U)', text: 'Underline the selected text.', cls: 'x-html-editor-tip' }, increasefontsize : { title: 'Grow Text', text: 'Increase the font size.', cls: 'x-html-editor-tip' }, decreasefontsize : { title: 'Shrink Text', text: 'Decrease the font size.', cls: 'x-html-editor-tip' }, backcolor : { title: 'Text Highlight Color', text: 'Change the background color of the selected text.', cls: 'x-html-editor-tip' }, forecolor : { title: 'Font Color', text: 'Change the color of the selected text.', cls: 'x-html-editor-tip' }, justifyleft : { title: 'Align Text Left', text: 'Align text to the left.', cls: 'x-html-editor-tip' }, justifycenter : { title: 'Center Text', text: 'Center text in the editor.', cls: 'x-html-editor-tip' }, justifyright : { title: 'Align Text Right', text: 'Align text to the right.', cls: 'x-html-editor-tip' }, insertunorderedlist : { title: 'Bullet List', text: 'Start a bulleted list.', cls: 'x-html-editor-tip' }, insertorderedlist : { title: 'Numbered List', text: 'Start a numbered list.', cls: 'x-html-editor-tip' }, createlink : { title: 'Hyperlink', text: 'Make the selected text a hyperlink.', cls: 'x-html-editor-tip' }, sourceedit : { title: 'Source Edit', text: 'Switch to source editing mode.', cls: 'x-html-editor-tip' } } }); Ext.reg('htmleditor', Ext.form.HtmlEditor); Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, { minValue : null, maxValue : null, minText : "The time in this field must be equal to or after {0}", maxText : "The time in this field must be equal to or before {0}", invalidText : "{0} is not a valid time", format : "g:i A", altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H", increment: 15, mode: 'local', triggerAction: 'all', typeAhead: false, initComponent : function(){ Ext.form.TimeField.superclass.initComponent.call(this); if(typeof this.minValue == "string"){ this.minValue = this.parseDate(this.minValue); } if(typeof this.maxValue == "string"){ this.maxValue = this.parseDate(this.maxValue); } if(!this.store){ var min = this.parseDate(this.minValue); if(!min){ min = new Date().clearTime(); } var max = this.parseDate(this.maxValue); if(!max){ max = new Date().clearTime().add('mi', (24 * 60) - 1); } var times = []; while(min <= max){ times.push([min.dateFormat(this.format)]); min = min.add('mi', this.increment); } this.store = new Ext.data.SimpleStore({ fields: ['text'], data : times }); this.displayField = 'text'; } }, getValue : function(){ var v = Ext.form.TimeField.superclass.getValue.call(this); return this.formatDate(this.parseDate(v)) || ''; }, setValue : function(value){ Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value))); }, validateValue : Ext.form.DateField.prototype.validateValue, parseDate : Ext.form.DateField.prototype.parseDate, formatDate : Ext.form.DateField.prototype.formatDate, beforeBlur : function(){ var v = this.parseDate(this.getRawValue()); if(v){ this.setValue(v.dateFormat(this.format)); } } }); Ext.reg('timefield', Ext.form.TimeField); Ext.form.Label = Ext.extend(Ext.BoxComponent, { onRender : function(ct, position){ if(!this.el){ this.el = document.createElement('label'); this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || ''); if(this.forId){ this.el.setAttribute('htmlFor', this.forId); } } Ext.form.Label.superclass.onRender.call(this, ct, position); } }); Ext.reg('label', Ext.form.Label); Ext.form.Action = function(form, options){ this.form = form; this.options = options || {}; }; Ext.form.Action.CLIENT_INVALID = 'client'; Ext.form.Action.SERVER_INVALID = 'server'; Ext.form.Action.CONNECT_FAILURE = 'connect'; Ext.form.Action.LOAD_FAILURE = 'load'; Ext.form.Action.prototype = { type : 'default', run : function(options){ }, success : function(response){ }, handleResponse : function(response){ }, failure : function(response){ this.response = response; this.failureType = Ext.form.Action.CONNECT_FAILURE; this.form.afterAction(this, false); }, processResponse : function(response){ this.response = response; if(!response.responseText){ return true; } this.result = this.handleResponse(response); return this.result; }, getUrl : function(appendParams){ var url = this.options.url || this.form.url || this.form.el.dom.action; if(appendParams){ var p = this.getParams(); if(p){ url += (url.indexOf('?') != -1 ? '&' : '?') + p; } } return url; }, getMethod : function(){ return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase(); }, getParams : function(){ var bp = this.form.baseParams; var p = this.options.params; if(p){ if(typeof p == "object"){ p = Ext.urlEncode(Ext.applyIf(p, bp)); }else if(typeof p == 'string' && bp){ p += '&' + Ext.urlEncode(bp); } }else if(bp){ p = Ext.urlEncode(bp); } return p; }, createCallback : function(opts){ var opts = opts || {}; return { success: this.success, failure: this.failure, scope: this, timeout: (opts.timeout*1000) || (this.form.timeout*1000), upload: this.form.fileUpload ? this.success : undefined }; } }; Ext.form.Action.Submit = function(form, options){ Ext.form.Action.Submit.superclass.constructor.call(this, form, options); }; Ext.extend(Ext.form.Action.Submit, Ext.form.Action, { type : 'submit', run : function(){ var o = this.options; var method = this.getMethod(); var isPost = method == 'POST'; if(o.clientValidation === false || this.form.isValid()){ Ext.Ajax.request(Ext.apply(this.createCallback(o), { form:this.form.el.dom, url:this.getUrl(!isPost), method: method, params:isPost ? this.getParams() : null, isUpload: this.form.fileUpload })); }else if (o.clientValidation !== false){ this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); } }, success : function(response){ var result = this.processResponse(response); if(result === true || result.success){ this.form.afterAction(this, true); return; } if(result.errors){ this.form.markInvalid(result.errors); this.failureType = Ext.form.Action.SERVER_INVALID; } this.form.afterAction(this, false); }, handleResponse : function(response){ if(this.form.errorReader){ var rs = this.form.errorReader.read(response); var errors = []; if(rs.records){ for(var i = 0, len = rs.records.length; i < len; i++) { var r = rs.records[i]; errors[i] = r.data; } } if(errors.length < 1){ errors = null; } return { success : rs.success, errors : errors }; } return Ext.decode(response.responseText); } }); Ext.form.Action.Load = function(form, options){ Ext.form.Action.Load.superclass.constructor.call(this, form, options); this.reader = this.form.reader; }; Ext.extend(Ext.form.Action.Load, Ext.form.Action, { type : 'load', run : function(){ Ext.Ajax.request(Ext.apply( this.createCallback(this.options), { method:this.getMethod(), url:this.getUrl(false), params:this.getParams() })); }, success : function(response){ var result = this.processResponse(response); if(result === true || !result.success || !result.data){ this.failureType = Ext.form.Action.LOAD_FAILURE; this.form.afterAction(this, false); return; } this.form.clearInvalid(); this.form.setValues(result.data); this.form.afterAction(this, true); }, handleResponse : function(response){ if(this.form.reader){ var rs = this.form.reader.read(response); var data = rs.records && rs.records[0] ? rs.records[0].data : null; return { success : rs.success, data : data }; } return Ext.decode(response.responseText); } }); Ext.form.Action.ACTION_TYPES = { 'load' : Ext.form.Action.Load, 'submit' : Ext.form.Action.Submit }; Ext.form.VTypes = function(){ var alpha = /^[a-zA-Z_]+$/; var alphanum = /^[a-zA-Z0-9_]+$/; var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/; var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; return { 'email' : function(v){ return email.test(v); }, 'emailText' : 'This field should be an e-mail address in the format "user@domain.com"', 'emailMask' : /[a-z0-9_\.\-@]/i, 'url' : function(v){ return url.test(v); }, 'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"', 'alpha' : function(v){ return alpha.test(v); }, 'alphaText' : 'This field should only contain letters and _', 'alphaMask' : /[a-z_]/i, 'alphanum' : function(v){ return alphanum.test(v); }, 'alphanumText' : 'This field should only contain letters, numbers and _', 'alphanumMask' : /[a-z0-9_]/i }; }(); Ext.grid.GridPanel = Ext.extend(Ext.Panel, { ddText : "{0} selected row{1}", minColumnWidth : 25, trackMouseOver : true, enableDragDrop : false, enableColumnMove : true, enableColumnHide : true, enableHdMenu : true, stripeRows : false, autoExpandColumn : false, autoExpandMin : 50, autoExpandMax : 1000, view : null, loadMask : false, rendered : false, viewReady: false, stateEvents: ["columnmove", "columnresize", "sortchange"], initComponent : function(){ Ext.grid.GridPanel.superclass.initComponent.call(this); this.autoScroll = false; this.autoWidth = false; if(Ext.isArray(this.columns)){ this.colModel = new Ext.grid.ColumnModel(this.columns); delete this.columns; } if(this.ds){ this.store = this.ds; delete this.ds; } if(this.cm){ this.colModel = this.cm; delete this.cm; } if(this.sm){ this.selModel = this.sm; delete this.sm; } this.store = Ext.StoreMgr.lookup(this.store); this.addEvents( "click", "dblclick", "contextmenu", "mousedown", "mouseup", "mouseover", "mouseout", "keypress", "keydown", "cellmousedown", "rowmousedown", "headermousedown", "cellclick", "celldblclick", "rowclick", "rowdblclick", "headerclick", "headerdblclick", "rowcontextmenu", "cellcontextmenu", "headercontextmenu", "bodyscroll", "columnresize", "columnmove", "sortchange" ); }, onRender : function(ct, position){ Ext.grid.GridPanel.superclass.onRender.apply(this, arguments); var c = this.body; this.el.addClass('x-grid-panel'); var view = this.getView(); view.init(this); c.on("mousedown", this.onMouseDown, this); c.on("click", this.onClick, this); c.on("dblclick", this.onDblClick, this); c.on("contextmenu", this.onContextMenu, this); c.on("keydown", this.onKeyDown, this); this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]); this.getSelectionModel().init(this); this.view.render(); }, initEvents : function(){ Ext.grid.GridPanel.superclass.initEvents.call(this); if(this.loadMask){ this.loadMask = new Ext.LoadMask(this.bwrap, Ext.apply({store:this.store}, this.loadMask)); } }, initStateEvents : function(){ Ext.grid.GridPanel.superclass.initStateEvents.call(this); this.colModel.on('hiddenchange', this.saveState, this, {delay: 100}); }, applyState : function(state){ var cm = this.colModel; var cs = state.columns; if(cs){ for(var i = 0, len = cs.length; i < len; i++){ var s = cs[i]; var c = cm.getColumnById(s.id); if(c){ c.hidden = s.hidden; c.width = s.width; var oldIndex = cm.getIndexById(s.id); if(oldIndex != i){ cm.moveColumn(oldIndex, i); } } } } if(state.sort){ this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction); } }, getState : function(){ var o = {columns: []}; for(var i = 0, c; c = this.colModel.config[i]; i++){ o.columns[i] = { id: c.id, width: c.width }; if(c.hidden){ o.columns[i].hidden = true; } } var ss = this.store.getSortState(); if(ss){ o.sort = ss; } return o; }, afterRender : function(){ Ext.grid.GridPanel.superclass.afterRender.call(this); this.view.layout(); this.viewReady = true; }, reconfigure : function(store, colModel){ if(this.loadMask){ this.loadMask.destroy(); this.loadMask = new Ext.LoadMask(this.bwrap, Ext.apply({store:store}, this.initialConfig.loadMask)); } this.view.bind(store, colModel); this.store = store; this.colModel = colModel; if(this.rendered){ this.view.refresh(true); } }, onKeyDown : function(e){ this.fireEvent("keydown", e); }, onDestroy : function(){ if(this.rendered){ if(this.loadMask){ this.loadMask.destroy(); } var c = this.body; c.removeAllListeners(); this.view.destroy(); c.update(""); } this.colModel.purgeListeners(); Ext.grid.GridPanel.superclass.onDestroy.call(this); }, processEvent : function(name, e){ this.fireEvent(name, e); var t = e.getTarget(); var v = this.view; var header = v.findHeaderIndex(t); if(header !== false){ this.fireEvent("header" + name, this, header, e); }else{ var row = v.findRowIndex(t); var cell = v.findCellIndex(t); if(row !== false){ this.fireEvent("row" + name, this, row, e); if(cell !== false){ this.fireEvent("cell" + name, this, row, cell, e); } } } }, onClick : function(e){ this.processEvent("click", e); }, onMouseDown : function(e){ this.processEvent("mousedown", e); }, onContextMenu : function(e, t){ this.processEvent("contextmenu", e); }, onDblClick : function(e){ this.processEvent("dblclick", e); }, walkCells : function(row, col, step, fn, scope){ var cm = this.colModel, clen = cm.getColumnCount(); var ds = this.store, rlen = ds.getCount(), first = true; if(step < 0){ if(col < 0){ row--; first = false; } while(row >= 0){ if(!first){ col = clen-1; } first = false; while(col >= 0){ if(fn.call(scope || this, row, col, cm) === true){ return [row, col]; } col--; } row--; } } else { if(col >= clen){ row++; first = false; } while(row < rlen){ if(!first){ col = 0; } first = false; while(col < clen){ if(fn.call(scope || this, row, col, cm) === true){ return [row, col]; } col++; } row++; } } return null; }, getSelections : function(){ return this.selModel.getSelections(); }, onResize : function(){ Ext.grid.GridPanel.superclass.onResize.apply(this, arguments); if(this.viewReady){ this.view.layout(); } }, getGridEl : function(){ return this.body; }, stopEditing : function(){}, getSelectionModel : function(){ if(!this.selModel){ this.selModel = new Ext.grid.RowSelectionModel( this.disableSelection ? {selectRow: Ext.emptyFn} : null); } return this.selModel; }, getStore : function(){ return this.store; }, getColumnModel : function(){ return this.colModel; }, getView : function(){ if(!this.view){ this.view = new Ext.grid.GridView(this.viewConfig); } return this.view; }, getDragDropText : function(){ var count = this.selModel.getCount(); return String.format(this.ddText, count, count == 1 ? '' : 's'); } }); Ext.reg('grid', Ext.grid.GridPanel); Ext.grid.GridView = function(config){ Ext.apply(this, config); this.addEvents( "beforerowremoved", "beforerowsinserted", "beforerefresh", "rowremoved", "rowsinserted", "rowupdated", "refresh" ); Ext.grid.GridView.superclass.constructor.call(this); }; Ext.extend(Ext.grid.GridView, Ext.util.Observable, { scrollOffset: 19, autoFill: false, forceFit: false, sortClasses : ["sort-asc", "sort-desc"], sortAscText : "Sort Ascending", sortDescText : "Sort Descending", columnsText : "Columns", borderWidth: 2, initTemplates : function(){ var ts = this.templates || {}; if(!ts.master){ ts.master = new Ext.Template( '<div class="x-grid3" hidefocus="true">', '<div class="x-grid3-viewport">', '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>', '<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>', "</div>", '<div class="x-grid3-resize-marker">&#160;</div>', '<div class="x-grid3-resize-proxy">&#160;</div>', "</div>" ); } if(!ts.header){ ts.header = new Ext.Template( '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">', '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>', "</table>" ); } if(!ts.hcell){ ts.hcell = new Ext.Template( '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '', '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />', "</div></td>" ); } if(!ts.body){ ts.body = new Ext.Template('{rows}'); } if(!ts.row){ ts.row = new Ext.Template( '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">', '<tbody><tr>{cells}</tr>', (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''), '</tbody></table></div>' ); } if(!ts.cell){ ts.cell = new Ext.Template( '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>', '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>', "</td>" ); } for(var k in ts){ var t = ts[k]; if(t && typeof t.compile == 'function' && !t.compiled){ t.disableFormats = true; t.compile(); } } this.templates = ts; this.tdClass = 'x-grid3-cell'; this.cellSelector = 'td.x-grid3-cell'; this.hdCls = 'x-grid3-hd'; this.rowSelector = 'div.x-grid3-row'; this.colRe = new RegExp("x-grid3-td-([^\\s]+)", ""); }, fly : function(el){ if(!this._flyweight){ this._flyweight = new Ext.Element.Flyweight(document.body); } this._flyweight.dom = el; return this._flyweight; }, getEditorParent : function(ed){ return this.scroller.dom; }, initElements : function(){ var E = Ext.Element; var el = this.grid.getGridEl().dom.firstChild; var cs = el.childNodes; this.el = new E(el); this.mainWrap = new E(cs[0]); this.mainHd = new E(this.mainWrap.dom.firstChild); if(this.grid.hideHeaders){ this.mainHd.setDisplayed(false); } this.innerHd = this.mainHd.dom.firstChild; this.scroller = new E(this.mainWrap.dom.childNodes[1]); if(this.forceFit){ this.scroller.setStyle('overflow-x', 'hidden'); } this.mainBody = new E(this.scroller.dom.firstChild); this.focusEl = new E(this.scroller.dom.childNodes[1]); this.focusEl.swallowEvent("click", true); this.resizeMarker = new E(cs[1]); this.resizeProxy = new E(cs[2]); }, getRows : function(){ return this.hasRows() ? this.mainBody.dom.childNodes : []; }, findCell : function(el){ if(!el){ return false; } return this.fly(el).findParent(this.cellSelector, 3); }, findCellIndex : function(el, requiredCls){ var cell = this.findCell(el); if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){ return this.getCellIndex(cell); } return false; }, getCellIndex : function(el){ if(el){ var m = el.className.match(this.colRe); if(m && m[1]){ return this.cm.getIndexById(m[1]); } } return false; }, findHeaderCell : function(el){ var cell = this.findCell(el); return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null; }, findHeaderIndex : function(el){ return this.findCellIndex(el, this.hdCls); }, findRow : function(el){ if(!el){ return false; } return this.fly(el).findParent(this.rowSelector, 10); }, findRowIndex : function(el){ var r = this.findRow(el); return r ? r.rowIndex : false; }, getRow : function(row){ return this.getRows()[row]; }, getCell : function(row, col){ return this.getRow(row).getElementsByTagName('td')[col]; }, getHeaderCell : function(index){ return this.mainHd.dom.getElementsByTagName('td')[index]; }, addRowClass : function(row, cls){ var r = this.getRow(row); if(r){ this.fly(r).addClass(cls); } }, removeRowClass : function(row, cls){ var r = this.getRow(row); if(r){ this.fly(r).removeClass(cls); } }, removeRow : function(row){ Ext.removeNode(this.getRow(row)); }, removeRows : function(firstRow, lastRow){ var bd = this.mainBody.dom; for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){ Ext.removeNode(bd.childNodes[firstRow]); } }, getScrollState : function(){ var sb = this.scroller.dom; return {left: sb.scrollLeft, top: sb.scrollTop}; }, restoreScroll : function(state){ var sb = this.scroller.dom; sb.scrollLeft = state.left; sb.scrollTop = state.top; }, scrollToTop : function(){ this.scroller.dom.scrollTop = 0; this.scroller.dom.scrollLeft = 0; }, syncScroll : function(){ this.syncHeaderScroll(); var mb = this.scroller.dom; this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop); }, syncHeaderScroll : function(){ var mb = this.scroller.dom; this.innerHd.scrollLeft = mb.scrollLeft; this.innerHd.scrollLeft = mb.scrollLeft; }, updateSortIcon : function(col, dir){ var sc = this.sortClasses; var hds = this.mainHd.select('td').removeClass(sc); hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]); }, updateAllColumnWidths : function(){ var tw = this.getTotalWidth(); var clen = this.cm.getColumnCount(); var ws = []; for(var i = 0; i < clen; i++){ ws[i] = this.getColumnWidth(i); } this.innerHd.firstChild.firstChild.style.width = tw; for(var i = 0; i < clen; i++){ var hd = this.getHeaderCell(i); hd.style.width = ws[i]; } var ns = this.getRows(); for(var i = 0, len = ns.length; i < len; i++){ ns[i].style.width = tw; ns[i].firstChild.style.width = tw; var row = ns[i].firstChild.rows[0]; for(var j = 0; j < clen; j++){ row.childNodes[j].style.width = ws[j]; } } this.onAllColumnWidthsUpdated(ws, tw); }, updateColumnWidth : function(col, width){ var w = this.getColumnWidth(col); var tw = this.getTotalWidth(); this.innerHd.firstChild.firstChild.style.width = tw; var hd = this.getHeaderCell(col); hd.style.width = w; var ns = this.getRows(); for(var i = 0, len = ns.length; i < len; i++){ ns[i].style.width = tw; ns[i].firstChild.style.width = tw; ns[i].firstChild.rows[0].childNodes[col].style.width = w; } this.onColumnWidthUpdated(col, w, tw); }, updateColumnHidden : function(col, hidden){ var tw = this.getTotalWidth(); this.innerHd.firstChild.firstChild.style.width = tw; var display = hidden ? 'none' : ''; var hd = this.getHeaderCell(col); hd.style.display = display; var ns = this.getRows(); for(var i = 0, len = ns.length; i < len; i++){ ns[i].style.width = tw; ns[i].firstChild.style.width = tw; ns[i].firstChild.rows[0].childNodes[col].style.display = display; } this.onColumnHiddenUpdated(col, hidden, tw); delete this.lastViewWidth; this.layout(); }, doRender : function(cs, rs, ds, startRow, colCount, stripe){ var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1; var tstyle = 'width:'+this.getTotalWidth()+';'; var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r; for(var j = 0, len = rs.length; j < len; j++){ r = rs[j]; cb = []; var rowIndex = (j+startRow); for(var i = 0; i < colCount; i++){ c = cs[i]; p.id = c.id; p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : ''); p.attr = p.cellAttr = ""; p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds); p.style = c.style; if(p.value == undefined || p.value === "") p.value = "&#160;"; if(r.dirty && typeof r.modified[c.name] !== 'undefined'){ p.css += ' x-grid3-dirty-cell'; } cb[cb.length] = ct.apply(p); } var alt = []; if(stripe && ((rowIndex+1) % 2 == 0)){ alt[0] = "x-grid3-row-alt"; } if(r.dirty){ alt[1] = " x-grid3-dirty-row"; } rp.cols = colCount; if(this.getRowClass){ alt[2] = this.getRowClass(r, rowIndex, rp, ds); } rp.alt = alt.join(" "); rp.cells = cb.join(""); buf[buf.length] = rt.apply(rp); } return buf.join(""); }, processRows : function(startRow, skipStripe){ if(this.ds.getCount() < 1){ return; } skipStripe = skipStripe || !this.grid.stripeRows; startRow = startRow || 0; var rows = this.getRows(); var cls = ' x-grid3-row-alt '; for(var i = startRow, len = rows.length; i < len; i++){ var row = rows[i]; row.rowIndex = i; if(!skipStripe){ var isAlt = ((i+1) % 2 == 0); var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1; if(isAlt == hasAlt){ continue; } if(isAlt){ row.className += " x-grid3-row-alt"; }else{ row.className = row.className.replace("x-grid3-row-alt", ""); } } } }, renderUI : function(){ var header = this.renderHeaders(); var body = this.templates.body.apply({rows:''}); var html = this.templates.master.apply({ body: body, header: header }); var g = this.grid; g.getGridEl().dom.innerHTML = html; this.initElements(); this.mainBody.dom.innerHTML = this.renderRows(); this.processRows(0, true); Ext.fly(this.innerHd).on("click", this.handleHdDown, this); this.mainHd.on("mouseover", this.handleHdOver, this); this.mainHd.on("mouseout", this.handleHdOut, this); this.mainHd.on("mousemove", this.handleHdMove, this); this.scroller.on('scroll', this.syncScroll, this); if(g.enableColumnResize !== false){ this.splitone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom); } if(g.enableColumnMove){ this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd); this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom); } if(g.enableHdMenu !== false){ if(g.enableColumnHide !== false){ this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"}); this.colMenu.on("beforeshow", this.beforeColMenuShow, this); this.colMenu.on("itemclick", this.handleHdMenuClick, this); } this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"}); this.hmenu.add( {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"}, {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"} ); if(g.enableColumnHide !== false){ this.hmenu.add('-', {id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'} ); } this.hmenu.on("itemclick", this.handleHdMenuClick, this); } if(g.enableDragDrop || g.enableDrag){ var dd = new Ext.grid.GridDragZone(g, { ddGroup : g.ddGroup || 'GridDD' }); } this.updateHeaderSortState(); }, layout : function(){ if(!this.mainBody){ return; } var g = this.grid; var c = g.getGridEl(), cm = this.cm, expandCol = g.autoExpandColumn, gv = this; var csize = c.getSize(true); var vw = csize.width; if(vw < 20 || csize.height < 20){ return; } if(g.autoHeight){ this.scroller.dom.style.overflow = 'visible'; }else{ this.el.setSize(csize.width, csize.height); var hdHeight = this.mainHd.getHeight(); var vh = csize.height - (hdHeight); this.scroller.setSize(vw, vh); if(this.innerHd){ this.innerHd.style.width = (vw)+'px'; } } if(this.forceFit){ if(this.lastViewWidth != vw){ this.fitColumns(false, false); this.lastViewWidth = vw; } }else { this.autoExpand(); this.syncHeaderScroll(); } this.onLayout(vw, vh); }, onLayout : function(vw, vh){ }, onColumnWidthUpdated : function(col, w, tw){ }, onAllColumnWidthsUpdated : function(ws, tw){ }, onColumnHiddenUpdated : function(col, hidden, tw){ }, updateColumnText : function(col, text){ }, afterMove : function(colIndex){ }, init: function(grid){ this.grid = grid; this.initTemplates(); this.initData(grid.store, grid.colModel); this.initUI(grid); }, getColumnId : function(index){ return this.cm.getColumnId(index); }, renderHeaders : function(){ var cm = this.cm, ts = this.templates; var ct = ts.hcell; var cb = [], sb = [], p = {}; for(var i = 0, len = cm.getColumnCount(); i < len; i++){ p.id = cm.getColumnId(i); p.value = cm.getColumnHeader(i) || ""; p.style = this.getColumnStyle(i, true); p.tooltip = this.getColumnTooltip(i); if(cm.config[i].align == 'right'){ p.istyle = 'padding-right:16px'; } else { delete p.istyle; } cb[cb.length] = ct.apply(p); } return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'}); }, getColumnTooltip : function(i){ var tt = this.cm.getColumnTooltip(i); if(tt){ if(Ext.QuickTips.isEnabled()){ return 'ext:qtip="'+tt+'"'; }else{ return 'title="'+tt+'"'; } } return ""; }, beforeUpdate : function(){ this.grid.stopEditing(true); }, updateHeaders : function(){ this.innerHd.firstChild.innerHTML = this.renderHeaders(); }, focusRow : function(row){ this.focusCell(row, 0, false); }, focusCell : function(row, col, hscroll){ var xy = this.ensureVisible(row, col, hscroll); this.focusEl.setXY(xy); if(Ext.isGecko){ this.focusEl.focus(); }else{ this.focusEl.focus.defer(1, this.focusEl); } }, ensureVisible : function(row, col, hscroll){ if(typeof row != "number"){ row = row.rowIndex; } if(!this.ds){ return; } if(row < 0 || row >= this.ds.getCount()){ return; } col = (col !== undefined ? col : 0); var rowEl = this.getRow(row), cellEl; if(!(hscroll === false && col === 0)){ while(this.cm.isHidden(col)){ col++; } cellEl = this.getCell(row, col); } if(!rowEl){ return; } var c = this.scroller.dom; var ctop = 0; var p = rowEl, stop = this.el.dom; while(p && p != stop){ ctop += p.offsetTop; p = p.offsetParent; } ctop -= this.mainHd.dom.offsetHeight; var cbot = ctop + rowEl.offsetHeight; var ch = c.clientHeight; var stop = parseInt(c.scrollTop, 10); var sbot = stop + ch; if(ctop < stop){ c.scrollTop = ctop; }else if(cbot > sbot){ c.scrollTop = cbot-ch; } if(hscroll !== false){ var cleft = parseInt(cellEl.offsetLeft, 10); var cright = cleft + cellEl.offsetWidth; var sleft = parseInt(c.scrollLeft, 10); var sright = sleft + c.clientWidth; if(cleft < sleft){ c.scrollLeft = cleft; }else if(cright > sright){ c.scrollLeft = cright-c.clientWidth; } } return cellEl ? Ext.fly(cellEl).getXY() : [c.scrollLeft, Ext.fly(rowEl).getY()]; }, insertRows : function(dm, firstRow, lastRow, isUpdate){ if(!isUpdate && firstRow === 0 && lastRow == dm.getCount()-1){ this.refresh(); }else{ if(!isUpdate){ this.fireEvent("beforerowsinserted", this, firstRow, lastRow); } var html = this.renderRows(firstRow, lastRow); var before = this.getRow(firstRow); if(before){ Ext.DomHelper.insertHtml('beforeBegin', before, html); }else{ Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html); } if(!isUpdate){ this.fireEvent("rowsinserted", this, firstRow, lastRow); this.processRows(firstRow); } } }, deleteRows : function(dm, firstRow, lastRow){ if(dm.getRowCount()<1){ this.refresh(); }else{ this.fireEvent("beforerowsdeleted", this, firstRow, lastRow); this.removeRows(firstRow, lastRow); this.processRows(firstRow); this.fireEvent("rowsdeleted", this, firstRow, lastRow); } }, getColumnStyle : function(col, isHeader){ var style = !isHeader ? (this.cm.config[col].css || '') : ''; style += 'width:'+this.getColumnWidth(col)+';'; if(this.cm.isHidden(col)){ style += 'display:none;'; } var align = this.cm.config[col].align; if(align){ style += 'text-align:'+align+';'; } return style; }, getColumnWidth : function(col){ var w = this.cm.getColumnWidth(col); if(typeof w == 'number'){ return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px'; } return w; }, getTotalWidth : function(){ return this.cm.getTotalWidth()+'px'; }, fitColumns : function(preventRefresh, onlyExpand, omitColumn){ var cm = this.cm, leftOver, dist, i; var tw = cm.getTotalWidth(false); var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset; if(aw < 20){ return; } var extra = aw - tw; if(extra === 0){ return false; } var vc = cm.getColumnCount(true); var ac = vc-(typeof omitColumn == 'number' ? 1 : 0); if(ac === 0){ ac = 1; omitColumn = undefined; } var colCount = cm.getColumnCount(); var cols = []; var extraCol = 0; var width = 0; var w; for (i = 0; i < colCount; i++){ if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){ w = cm.getColumnWidth(i); cols.push(i); extraCol = i; cols.push(w); width += w; } } var frac = (aw - cm.getTotalWidth())/width; while (cols.length){ w = cols.pop(); i = cols.pop(); cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true); } if((tw = cm.getTotalWidth(false)) > aw){ var adjustCol = ac != vc ? omitColumn : extraCol; cm.setColumnWidth(adjustCol, Math.max(1, cm.getColumnWidth(adjustCol)- (tw-aw)), true); } if(preventRefresh !== true){ this.updateAllColumnWidths(); } return true; }, autoExpand : function(preventUpdate){ var g = this.grid, cm = this.cm; if(!this.userResized && g.autoExpandColumn){ var tw = cm.getTotalWidth(false); var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset; if(tw != aw){ var ci = cm.getIndexById(g.autoExpandColumn); var currentWidth = cm.getColumnWidth(ci); var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax); if(cw != currentWidth){ cm.setColumnWidth(ci, cw, true); if(preventUpdate !== true){ this.updateColumnWidth(ci, cw); } } } } }, getColumnData : function(){ var cs = [], cm = this.cm, colCount = cm.getColumnCount(); for(var i = 0; i < colCount; i++){ var name = cm.getDataIndex(i); cs[i] = { name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name), renderer : cm.getRenderer(i), id : cm.getColumnId(i), style : this.getColumnStyle(i) }; } return cs; }, renderRows : function(startRow, endRow){ var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows; var colCount = cm.getColumnCount(); if(ds.getCount() < 1){ return ""; } var cs = this.getColumnData(); startRow = startRow || 0; endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow; var rs = ds.getRange(startRow, endRow); return this.doRender(cs, rs, ds, startRow, colCount, stripe); }, renderBody : function(){ var markup = this.renderRows(); return this.templates.body.apply({rows: markup}); }, refreshRow : function(record){ var ds = this.ds, index; if(typeof record == 'number'){ index = record; record = ds.getAt(index); }else{ index = ds.indexOf(record); } var cls = []; this.insertRows(ds, index, index, true); this.getRow(index).rowIndex = index; this.onRemove(ds, record, index+1, true); this.fireEvent("rowupdated", this, index, record); }, refresh : function(headersToo){ this.fireEvent("beforerefresh", this); this.grid.stopEditing(true); var result = this.renderBody(); this.mainBody.update(result); if(headersToo === true){ this.updateHeaders(); this.updateHeaderSortState(); } this.processRows(0, true); this.layout(); this.applyEmptyText(); this.fireEvent("refresh", this); }, applyEmptyText : function(){ if(this.emptyText && !this.hasRows()){ this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>'); } }, updateHeaderSortState : function(){ var state = this.ds.getSortState(); if(!state){ return; } if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){ this.grid.fireEvent('sortchange', this.grid, state); } this.sortState = state; var sortColumn = this.cm.findColumnIndex(state.field); if(sortColumn != -1){ var sortDir = state.direction; this.updateSortIcon(sortColumn, sortDir); } }, destroy : function(){ if(this.colMenu){ this.colMenu.removeAll(); Ext.menu.MenuMgr.unregister(this.colMenu); this.colMenu.getEl().remove(); delete this.colMenu; } if(this.hmenu){ this.hmenu.removeAll(); Ext.menu.MenuMgr.unregister(this.hmenu); this.hmenu.getEl().remove(); delete this.hmenu; } if(this.grid.enableColumnMove){ var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id]; if(dds){ for(var dd in dds){ if(!dds[dd].config.isTarget && dds[dd].dragElId){ var elid = dds[dd].dragElId; dds[dd].unreg(); Ext.get(elid).remove(); } else if(dds[dd].config.isTarget){ dds[dd].proxyTop.remove(); dds[dd].proxyBottom.remove(); dds[dd].unreg(); } if(Ext.dd.DDM.locationCache[dd]){ delete Ext.dd.DDM.locationCache[dd]; } } delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id]; } } Ext.destroy(this.resizeMarker, this.resizeProxy); this.initData(null, null); Ext.EventManager.removeResizeListener(this.onWindowResize, this); }, onDenyColumnHide : function(){ }, render : function(){ var cm = this.cm; var colCount = cm.getColumnCount(); if(this.autoFill){ this.fitColumns(true, true); }else if(this.forceFit){ this.fitColumns(true, false); }else if(this.grid.autoExpandColumn){ this.autoExpand(true); } this.renderUI(); }, initData : function(ds, cm){ if(this.ds){ this.ds.un("load", this.onLoad, this); this.ds.un("datachanged", this.onDataChange, this); this.ds.un("add", this.onAdd, this); this.ds.un("remove", this.onRemove, this); this.ds.un("update", this.onUpdate, this); this.ds.un("clear", this.onClear, this); } if(ds){ ds.on("load", this.onLoad, this); ds.on("datachanged", this.onDataChange, this); ds.on("add", this.onAdd, this); ds.on("remove", this.onRemove, this); ds.on("update", this.onUpdate, this); ds.on("clear", this.onClear, this); } this.ds = ds; if(this.cm){ this.cm.un("configchange", this.onColConfigChange, this); this.cm.un("widthchange", this.onColWidthChange, this); this.cm.un("headerchange", this.onHeaderChange, this); this.cm.un("hiddenchange", this.onHiddenChange, this); this.cm.un("columnmoved", this.onColumnMove, this); this.cm.un("columnlockchange", this.onColumnLock, this); } if(cm){ cm.on("configchange", this.onColConfigChange, this); cm.on("widthchange", this.onColWidthChange, this); cm.on("headerchange", this.onHeaderChange, this); cm.on("hiddenchange", this.onHiddenChange, this); cm.on("columnmoved", this.onColumnMove, this); cm.on("columnlockchange", this.onColumnLock, this); } this.cm = cm; }, onDataChange : function(){ this.refresh(); this.updateHeaderSortState(); }, onClear : function(){ this.refresh(); }, onUpdate : function(ds, record){ this.refreshRow(record); }, onAdd : function(ds, records, index){ this.insertRows(ds, index, index + (records.length-1)); }, onRemove : function(ds, record, index, isUpdate){ if(isUpdate !== true){ this.fireEvent("beforerowremoved", this, index, record); } this.removeRow(index); if(isUpdate !== true){ this.processRows(index); this.applyEmptyText(); this.fireEvent("rowremoved", this, index, record); } }, onLoad : function(){ this.scrollToTop(); }, onColWidthChange : function(cm, col, width){ this.updateColumnWidth(col, width); }, onHeaderChange : function(cm, col, text){ this.updateHeaders(); }, onHiddenChange : function(cm, col, hidden){ this.updateColumnHidden(col, hidden); }, onColumnMove : function(cm, oldIndex, newIndex){ this.indexMap = null; var s = this.getScrollState(); this.refresh(true); this.restoreScroll(s); this.afterMove(newIndex); }, onColConfigChange : function(){ delete this.lastViewWidth; this.indexMap = null; this.refresh(true); }, initUI : function(grid){ grid.on("headerclick", this.onHeaderClick, this); if(grid.trackMouseOver){ grid.on("mouseover", this.onRowOver, this); grid.on("mouseout", this.onRowOut, this); } }, initEvents : function(){ }, onHeaderClick : function(g, index){ if(this.headersDisabled || !this.cm.isSortable(index)){ return; } g.stopEditing(true); g.store.sort(this.cm.getDataIndex(index)); }, onRowOver : function(e, t){ var row; if((row = this.findRowIndex(t)) !== false){ this.addRowClass(row, "x-grid3-row-over"); } }, onRowOut : function(e, t){ var row; if((row = this.findRowIndex(t)) !== false && row !== this.findRowIndex(e.getRelatedTarget())){ this.removeRowClass(row, "x-grid3-row-over"); } }, handleWheel : function(e){ e.stopPropagation(); }, onRowSelect : function(row){ this.addRowClass(row, "x-grid3-row-selected"); }, onRowDeselect : function(row){ this.removeRowClass(row, "x-grid3-row-selected"); }, onCellSelect : function(row, col){ var cell = this.getCell(row, col); if(cell){ this.fly(cell).addClass("x-grid3-cell-selected"); } }, onCellDeselect : function(row, col){ var cell = this.getCell(row, col); if(cell){ this.fly(cell).removeClass("x-grid3-cell-selected"); } }, onColumnSplitterMoved : function(i, w){ this.userResized = true; var cm = this.grid.colModel; cm.setColumnWidth(i, w, true); if(this.forceFit){ this.fitColumns(true, false, i); this.updateAllColumnWidths(); }else{ this.updateColumnWidth(i, w); } this.grid.fireEvent("columnresize", i, w); }, handleHdMenuClick : function(item){ var index = this.hdCtxIndex; var cm = this.cm, ds = this.ds; switch(item.id){ case "asc": ds.sort(cm.getDataIndex(index), "ASC"); break; case "desc": ds.sort(cm.getDataIndex(index), "DESC"); break; default: index = cm.getIndexById(item.id.substr(4)); if(index != -1){ if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){ this.onDenyColumnHide(); return false; } cm.setHidden(index, item.checked); } } return true; }, isHideableColumn : function(c){ return !c.hidden && !c.fixed; }, beforeColMenuShow : function(){ var cm = this.cm, colCount = cm.getColumnCount(); this.colMenu.removeAll(); for(var i = 0; i < colCount; i++){ if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){ this.colMenu.add(new Ext.menu.CheckItem({ id: "col-"+cm.getColumnId(i), text: cm.getColumnHeader(i), checked: !cm.isHidden(i), hideOnClick:false, disabled: cm.config[i].hideable === false })); } } }, handleHdDown : function(e, t){ if(Ext.fly(t).hasClass('x-grid3-hd-btn')){ e.stopEvent(); var hd = this.findHeaderCell(t); Ext.fly(hd).addClass('x-grid3-hd-menu-open'); var index = this.getCellIndex(hd); this.hdCtxIndex = index; var ms = this.hmenu.items, cm = this.cm; ms.get("asc").setDisabled(!cm.isSortable(index)); ms.get("desc").setDisabled(!cm.isSortable(index)); this.hmenu.on("hide", function(){ Ext.fly(hd).removeClass('x-grid3-hd-menu-open'); }, this, {single:true}); this.hmenu.show(t, "tl-bl?"); } }, handleHdOver : function(e, t){ var hd = this.findHeaderCell(t); if(hd && !this.headersDisabled){ this.activeHd = hd; this.activeHdIndex = this.getCellIndex(hd); var fly = this.fly(hd); this.activeHdRegion = fly.getRegion(); if(!this.cm.isMenuDisabled(this.activeHdIndex)){ fly.addClass("x-grid3-hd-over"); this.activeHdBtn = fly.child('.x-grid3-hd-btn'); if(this.activeHdBtn){ this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px'; } } } }, handleHdMove : function(e, t){ if(this.activeHd && !this.headersDisabled){ var hw = this.splitHandleWidth || 5; var r = this.activeHdRegion; var x = e.getPageX(); var ss = this.activeHd.style; if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){ ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'e-resize' : 'col-resize'; }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){ ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'w-resize' : 'col-resize'; }else{ ss.cursor = ''; } } }, handleHdOut : function(e, t){ var hd = this.findHeaderCell(t); if(hd && (!Ext.isIE || !e.within(hd, true))){ this.activeHd = null; this.fly(hd).removeClass("x-grid3-hd-over"); hd.style.cursor = ''; } }, hasRows : function(){ var fc = this.mainBody.dom.firstChild; return fc && fc.className != 'x-grid-empty'; }, bind : function(d, c){ this.initData(d, c); } }); Ext.grid.GridView.SplitDragZone = function(grid, hd){ this.grid = grid; this.view = grid.getView(); this.marker = this.view.resizeMarker; this.proxy = this.view.resizeProxy; Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd, "gridSplitters" + this.grid.getGridEl().id, { dragElId : Ext.id(this.proxy.dom), resizeFrame:false }); this.scroll = false; this.hw = this.view.splitHandleWidth || 5; }; Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, { b4StartDrag : function(x, y){ this.view.headersDisabled = true; var h = this.view.mainWrap.getHeight(); this.marker.setHeight(h); this.marker.show(); this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]); this.proxy.setHeight(h); var w = this.cm.getColumnWidth(this.cellIndex); var minw = Math.max(w-this.grid.minColumnWidth, 0); this.resetConstraints(); this.setXConstraint(minw, 1000); this.setYConstraint(0, 0); this.minX = x - minw; this.maxX = x + 1000; this.startPos = x; Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y); }, handleMouseDown : function(e){ var t = this.view.findHeaderCell(e.getTarget()); if(t){ var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1]; var exy = e.getXY(), ex = exy[0], ey = exy[1]; var w = t.offsetWidth, adjust = false; if((ex - x) <= this.hw){ adjust = -1; }else if((x+w) - ex <= this.hw){ adjust = 0; } if(adjust !== false){ this.cm = this.grid.colModel; var ci = this.view.getCellIndex(t); if(adjust == -1){ if (ci + adjust < 0) { return; } while(this.cm.isHidden(ci+adjust)){ --adjust; if(ci+adjust < 0){ return; } } } this.cellIndex = ci+adjust; this.split = t.dom; if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){ Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments); } }else if(this.view.columnDrag){ this.view.columnDrag.callHandleMouseDown(e); } } }, endDrag : function(e){ this.marker.hide(); var v = this.view; var endX = Math.max(this.minX, e.getPageX()); var diff = endX - this.startPos; v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff); setTimeout(function(){ v.headersDisabled = false; }, 50); }, autoOffset : function(){ this.setDelta(0,0); } }); Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, { hideGroupedColumn:false, showGroupName:true, startCollapsed:false, enableGrouping:true, enableGroupingMenu:true, enableNoGroups:true, emptyGroupText : '(None)', ignoreAdd: false, groupTextTpl : '{text}', gidSeed : 1000, initTemplates : function(){ Ext.grid.GroupingView.superclass.initTemplates.call(this); this.state = {}; var sm = this.grid.getSelectionModel(); sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect', this.onBeforeRowSelect, this); if(!this.startGroup){ this.startGroup = new Ext.XTemplate( '<div id="{groupId}" class="x-grid-group {cls}">', '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>', this.groupTextTpl ,'</div></div>', '<div id="{groupId}-bd" class="x-grid-group-body">' ); } this.startGroup.compile(); this.endGroup = '</div></div>'; }, findGroup : function(el){ return Ext.fly(el).up('.x-grid-group', this.mainBody.dom); }, getGroups : function(){ return this.hasRows() ? this.mainBody.dom.childNodes : []; }, onAdd : function(){ if(this.enableGrouping && !this.ignoreAdd){ var ss = this.getScrollState(); this.refresh(); this.restoreScroll(ss); }else if(!this.enableGrouping){ Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments); } }, onRemove : function(ds, record, index, isUpdate){ Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments); var g = document.getElementById(record._groupId); if(g && g.childNodes[1].childNodes.length < 1){ Ext.removeNode(g); } this.applyEmptyText(); }, refreshRow : function(record){ if(this.ds.getCount()==1){ this.refresh(); }else{ this.isUpdating = true; Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments); this.isUpdating = false; } }, beforeMenuShow : function(){ var field = this.getGroupField(); var g = this.hmenu.items.get('groupBy'); if(g){ g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false); } var s = this.hmenu.items.get('showGroups'); if(s){ if (!!field){ s.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false) } s.setChecked(!!field); } }, renderUI : function(){ Ext.grid.GroupingView.superclass.renderUI.call(this); this.mainBody.on('mousedown', this.interceptMouse, this); if(this.enableGroupingMenu && this.hmenu){ this.hmenu.add('-',{ id:'groupBy', text: this.groupByText, handler: this.onGroupByClick, scope: this, iconCls:'x-group-by-icon' }); if(this.enableNoGroups){ this.hmenu.add({ id:'showGroups', text: this.showGroupsText, checked: true, checkHandler: this.onShowGroupsClick, scope: this }); } this.hmenu.on('beforeshow', this.beforeMenuShow, this); } }, onGroupByClick : function(){ this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex)); this.beforeMenuShow(); }, onShowGroupsClick : function(mi, checked){ if(checked){ this.onGroupByClick(); }else{ this.grid.store.clearGrouping(); } }, toggleGroup : function(group, expanded){ this.grid.stopEditing(true); group = Ext.getDom(group); var gel = Ext.fly(group); expanded = expanded !== undefined ? expanded : gel.hasClass('x-grid-group-collapsed'); this.state[gel.dom.id] = expanded; gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed'); }, toggleAllGroups : function(expanded){ var groups = this.getGroups(); for(var i = 0, len = groups.length; i < len; i++){ this.toggleGroup(groups[i], expanded); } }, expandAllGroups : function(){ this.toggleAllGroups(true); }, collapseAllGroups : function(){ this.toggleAllGroups(false); }, interceptMouse : function(e){ var hd = e.getTarget('.x-grid-group-hd', this.mainBody); if(hd){ e.stopEvent(); this.toggleGroup(hd.parentNode); } }, getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){ var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v); if(g === ''){ g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText; } return g; }, getGroupField : function(){ return this.grid.store.getGroupState(); }, renderRows : function(){ var groupField = this.getGroupField(); var eg = !!groupField; if(this.hideGroupedColumn) { var colIndex = this.cm.findColumnIndex(groupField); if(!eg && this.lastGroupField !== undefined) { this.mainBody.update(''); this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false); delete this.lastGroupField; }else if (eg && this.lastGroupField === undefined) { this.lastGroupField = groupField; this.cm.setHidden(colIndex, true); }else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) { this.mainBody.update(''); var oldIndex = this.cm.findColumnIndex(this.lastGroupField); this.cm.setHidden(oldIndex, false); this.lastGroupField = groupField; this.cm.setHidden(colIndex, true); } } return Ext.grid.GroupingView.superclass.renderRows.apply( this, arguments); }, doRender : function(cs, rs, ds, startRow, colCount, stripe){ if(rs.length < 1){ return ''; } var groupField = this.getGroupField(); var colIndex = this.cm.findColumnIndex(groupField); this.enableGrouping = !!groupField; if(!this.enableGrouping || this.isUpdating){ return Ext.grid.GroupingView.superclass.doRender.apply( this, arguments); } var gstyle = 'width:'+this.getTotalWidth()+';'; var gidPrefix = this.grid.getGridEl().id; var cfg = this.cm.config[colIndex]; var groupRenderer = cfg.groupRenderer || cfg.renderer; var prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : ''; var groups = [], curGroup, i, len, gid; for(i = 0, len = rs.length; i < len; i++){ var rowIndex = startRow + i; var r = rs[i], gvalue = r.data[groupField], g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds); if(!curGroup || curGroup.group != g){ gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g); var isCollapsed = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed; var gcls = isCollapsed ? 'x-grid-group-collapsed' : ''; curGroup = { group: g, gvalue: gvalue, text: prefix + g, groupId: gid, startRow: rowIndex, rs: [r], cls: gcls, style: gstyle }; groups.push(curGroup); }else{ curGroup.rs.push(r); } r._groupId = gid; } var buf = []; for(i = 0, len = groups.length; i < len; i++){ var g = groups[i]; this.doGroupStart(buf, g, cs, ds, colCount); buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call( this, cs, g.rs, ds, g.startRow, colCount, stripe); this.doGroupEnd(buf, g, cs, ds, colCount); } return buf.join(''); }, getGroupId : function(value){ var gidPrefix = this.grid.getGridEl().id; var groupField = this.getGroupField(); var colIndex = this.cm.findColumnIndex(groupField); var cfg = this.cm.config[colIndex]; var groupRenderer = cfg.groupRenderer || cfg.renderer; var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds); return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value); }, doGroupStart : function(buf, g, cs, ds, colCount){ buf[buf.length] = this.startGroup.apply(g); }, doGroupEnd : function(buf, g, cs, ds, colCount){ buf[buf.length] = this.endGroup; }, getRows : function(){ if(!this.enableGrouping){ return Ext.grid.GroupingView.superclass.getRows.call(this); } var r = []; var g, gs = this.getGroups(); for(var i = 0, len = gs.length; i < len; i++){ g = gs[i].childNodes[1].childNodes; for(var j = 0, jlen = g.length; j < jlen; j++){ r[r.length] = g[j]; } } return r; }, updateGroupWidths : function(){ if(!this.enableGrouping || !this.hasRows()){ return; } var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px'; var gs = this.getGroups(); for(var i = 0, len = gs.length; i < len; i++){ gs[i].firstChild.style.width = tw; } }, onColumnWidthUpdated : function(col, w, tw){ this.updateGroupWidths(); }, onAllColumnWidthsUpdated : function(ws, tw){ this.updateGroupWidths(); }, onColumnHiddenUpdated : function(col, hidden, tw){ this.updateGroupWidths(); }, onLayout : function(){ this.updateGroupWidths(); }, onBeforeRowSelect : function(sm, rowIndex){ if(!this.enableGrouping){ return; } var row = this.getRow(rowIndex); if(row && !row.offsetParent){ var g = this.findGroup(row); this.toggleGroup(g, true); } }, groupByText: 'Group By This Field', showGroupsText: 'Show in Groups' }); Ext.grid.GroupingView.GROUP_ID = 1000; Ext.grid.HeaderDragZone = function(grid, hd, hd2){ this.grid = grid; this.view = grid.getView(); this.ddGroup = "gridHeader" + this.grid.getGridEl().id; Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd); if(hd2){ this.setHandleElId(Ext.id(hd)); this.setOuterHandleElId(Ext.id(hd2)); } this.scroll = false; }; Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, { maxDragWidth: 120, getDragData : function(e){ var t = Ext.lib.Event.getTarget(e); var h = this.view.findHeaderCell(t); if(h){ return {ddel: h.firstChild, header:h}; } return false; }, onInitDrag : function(e){ this.view.headersDisabled = true; var clone = this.dragData.ddel.cloneNode(true); clone.id = Ext.id(); clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px"; this.proxy.update(clone); return true; }, afterValidDrop : function(){ var v = this.view; setTimeout(function(){ v.headersDisabled = false; }, 50); }, afterInvalidDrop : function(){ var v = this.view; setTimeout(function(){ v.headersDisabled = false; }, 50); } }); Ext.grid.HeaderDropZone = function(grid, hd, hd2){ this.grid = grid; this.view = grid.getView(); this.proxyTop = Ext.DomHelper.append(document.body, { cls:"col-move-top", html:"&#160;" }, true); this.proxyBottom = Ext.DomHelper.append(document.body, { cls:"col-move-bottom", html:"&#160;" }, true); this.proxyTop.hide = this.proxyBottom.hide = function(){ this.setLeftTop(-100,-100); this.setStyle("visibility", "hidden"); }; this.ddGroup = "gridHeader" + this.grid.getGridEl().id; Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom); }; Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, { proxyOffsets : [-4, -9], fly: Ext.Element.fly, getTargetFromEvent : function(e){ var t = Ext.lib.Event.getTarget(e); var cindex = this.view.findCellIndex(t); if(cindex !== false){ return this.view.getHeaderCell(cindex); } }, nextVisible : function(h){ var v = this.view, cm = this.grid.colModel; h = h.nextSibling; while(h){ if(!cm.isHidden(v.getCellIndex(h))){ return h; } h = h.nextSibling; } return null; }, prevVisible : function(h){ var v = this.view, cm = this.grid.colModel; h = h.prevSibling; while(h){ if(!cm.isHidden(v.getCellIndex(h))){ return h; } h = h.prevSibling; } return null; }, positionIndicator : function(h, n, e){ var x = Ext.lib.Event.getPageX(e); var r = Ext.lib.Dom.getRegion(n.firstChild); var px, pt, py = r.top + this.proxyOffsets[1]; if((r.right - x) <= (r.right-r.left)/2){ px = r.right+this.view.borderWidth; pt = "after"; }else{ px = r.left; pt = "before"; } var oldIndex = this.view.getCellIndex(h); var newIndex = this.view.getCellIndex(n); if(this.grid.colModel.isFixed(newIndex)){ return false; } var locked = this.grid.colModel.isLocked(newIndex); if(pt == "after"){ newIndex++; } if(oldIndex < newIndex){ newIndex--; } if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){ return false; } px += this.proxyOffsets[0]; this.proxyTop.setLeftTop(px, py); this.proxyTop.show(); if(!this.bottomOffset){ this.bottomOffset = this.view.mainHd.getHeight(); } this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset); this.proxyBottom.show(); return pt; }, onNodeEnter : function(n, dd, e, data){ if(data.header != n){ this.positionIndicator(data.header, n, e); } }, onNodeOver : function(n, dd, e, data){ var result = false; if(data.header != n){ result = this.positionIndicator(data.header, n, e); } if(!result){ this.proxyTop.hide(); this.proxyBottom.hide(); } return result ? this.dropAllowed : this.dropNotAllowed; }, onNodeOut : function(n, dd, e, data){ this.proxyTop.hide(); this.proxyBottom.hide(); }, onNodeDrop : function(n, dd, e, data){ var h = data.header; if(h != n){ var cm = this.grid.colModel; var x = Ext.lib.Event.getPageX(e); var r = Ext.lib.Dom.getRegion(n.firstChild); var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before"; var oldIndex = this.view.getCellIndex(h); var newIndex = this.view.getCellIndex(n); var locked = cm.isLocked(newIndex); if(pt == "after"){ newIndex++; } if(oldIndex < newIndex){ newIndex--; } if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){ return false; } cm.setLocked(oldIndex, locked, true); cm.moveColumn(oldIndex, newIndex); this.grid.fireEvent("columnmove", oldIndex, newIndex); return true; } return false; } }); Ext.grid.GridView.ColumnDragZone = function(grid, hd){ Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null); this.proxy.el.addClass('x-grid3-col-dd'); }; Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, { handleMouseDown : function(e){ }, callHandleMouseDown : function(e){ Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e); } }); Ext.grid.SplitDragZone = function(grid, hd, hd2){ this.grid = grid; this.view = grid.getView(); this.proxy = this.view.resizeProxy; Ext.grid.SplitDragZone.superclass.constructor.call(this, hd, "gridSplitters" + this.grid.getGridEl().id, { dragElId : Ext.id(this.proxy.dom), resizeFrame:false }); this.setHandleElId(Ext.id(hd)); this.setOuterHandleElId(Ext.id(hd2)); this.scroll = false; }; Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, { fly: Ext.Element.fly, b4StartDrag : function(x, y){ this.view.headersDisabled = true; this.proxy.setHeight(this.view.mainWrap.getHeight()); var w = this.cm.getColumnWidth(this.cellIndex); var minw = Math.max(w-this.grid.minColumnWidth, 0); this.resetConstraints(); this.setXConstraint(minw, 1000); this.setYConstraint(0, 0); this.minX = x - minw; this.maxX = x + 1000; this.startPos = x; Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y); }, handleMouseDown : function(e){ ev = Ext.EventObject.setEvent(e); var t = this.fly(ev.getTarget()); if(t.hasClass("x-grid-split")){ this.cellIndex = this.view.getCellIndex(t.dom); this.split = t.dom; this.cm = this.grid.colModel; if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){ Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments); } } }, endDrag : function(e){ this.view.headersDisabled = false; var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e)); var diff = endX - this.startPos; this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff); }, autoOffset : function(){ this.setDelta(0,0); } }); Ext.grid.GridDragZone = function(grid, config){ this.view = grid.getView(); Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config); if(this.view.lockedBody){ this.setHandleElId(Ext.id(this.view.mainBody.dom)); this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom)); } this.scroll = false; this.grid = grid; this.ddel = document.createElement('div'); this.ddel.className = 'x-grid-dd-wrap'; }; Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, { ddGroup : "GridDD", getDragData : function(e){ var t = Ext.lib.Event.getTarget(e); var rowIndex = this.view.findRowIndex(t); if(rowIndex !== false){ var sm = this.grid.selModel; if(!sm.isSelected(rowIndex) || e.hasModifier()){ sm.handleMouseDown(this.grid, rowIndex, e); } return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()}; } return false; }, onInitDrag : function(e){ var data = this.dragData; this.ddel.innerHTML = this.grid.getDragDropText(); this.proxy.update(this.ddel); }, afterRepair : function(){ this.dragging = false; }, getRepairXY : function(e, data){ return false; }, onEndDrag : function(data, e){ }, onValidDrop : function(dd, e, id){ this.hideProxy(); }, beforeInvalidDrop : function(e, id){ } }); Ext.grid.ColumnModel = function(config){ this.defaultWidth = 100; this.defaultSortable = false; if(config.columns){ Ext.apply(this, config); this.setConfig(config.columns, true); }else{ this.setConfig(config, true); } this.addEvents( "widthchange", "headerchange", "hiddenchange", "columnmoved", "columnlockchange", "configchange" ); Ext.grid.ColumnModel.superclass.constructor.call(this); }; Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, { getColumnId : function(index){ return this.config[index].id; }, setConfig : function(config, initial){ if(!initial){ delete this.totalWidth; for(var i = 0, len = this.config.length; i < len; i++){ var c = this.config[i]; if(c.editor){ c.editor.destroy(); } } } this.config = config; this.lookup = {}; for(var i = 0, len = config.length; i < len; i++){ var c = config[i]; if(typeof c.renderer == "string"){ c.renderer = Ext.util.Format[c.renderer]; } if(typeof c.id == "undefined"){ c.id = i; } if(c.editor && c.editor.isFormField){ c.editor = new Ext.grid.GridEditor(c.editor); } this.lookup[c.id] = c; } if(!initial){ this.fireEvent('configchange', this); } }, getColumnById : function(id){ return this.lookup[id]; }, getIndexById : function(id){ for(var i = 0, len = this.config.length; i < len; i++){ if(this.config[i].id == id){ return i; } } return -1; }, moveColumn : function(oldIndex, newIndex){ var c = this.config[oldIndex]; this.config.splice(oldIndex, 1); this.config.splice(newIndex, 0, c); this.dataMap = null; this.fireEvent("columnmoved", this, oldIndex, newIndex); }, isLocked : function(colIndex){ return this.config[colIndex].locked === true; }, setLocked : function(colIndex, value, suppressEvent){ if(this.isLocked(colIndex) == value){ return; } this.config[colIndex].locked = value; if(!suppressEvent){ this.fireEvent("columnlockchange", this, colIndex, value); } }, getTotalLockedWidth : function(){ var totalWidth = 0; for(var i = 0; i < this.config.length; i++){ if(this.isLocked(i) && !this.isHidden(i)){ this.totalWidth += this.getColumnWidth(i); } } return totalWidth; }, getLockedCount : function(){ for(var i = 0, len = this.config.length; i < len; i++){ if(!this.isLocked(i)){ return i; } } }, getColumnCount : function(visibleOnly){ if(visibleOnly === true){ var c = 0; for(var i = 0, len = this.config.length; i < len; i++){ if(!this.isHidden(i)){ c++; } } return c; } return this.config.length; }, getColumnsBy : function(fn, scope){ var r = []; for(var i = 0, len = this.config.length; i < len; i++){ var c = this.config[i]; if(fn.call(scope||this, c, i) === true){ r[r.length] = c; } } return r; }, isSortable : function(col){ if(typeof this.config[col].sortable == "undefined"){ return this.defaultSortable; } return this.config[col].sortable; }, isMenuDisabled : function(col){ return !!this.config[col].menuDisabled; }, getRenderer : function(col){ if(!this.config[col].renderer){ return Ext.grid.ColumnModel.defaultRenderer; } return this.config[col].renderer; }, setRenderer : function(col, fn){ this.config[col].renderer = fn; }, getColumnWidth : function(col){ return this.config[col].width || this.defaultWidth; }, setColumnWidth : function(col, width, suppressEvent){ this.config[col].width = width; this.totalWidth = null; if(!suppressEvent){ this.fireEvent("widthchange", this, col, width); } }, getTotalWidth : function(includeHidden){ if(!this.totalWidth){ this.totalWidth = 0; for(var i = 0, len = this.config.length; i < len; i++){ if(includeHidden || !this.isHidden(i)){ this.totalWidth += this.getColumnWidth(i); } } } return this.totalWidth; }, getColumnHeader : function(col){ return this.config[col].header; }, setColumnHeader : function(col, header){ this.config[col].header = header; this.fireEvent("headerchange", this, col, header); }, getColumnTooltip : function(col){ return this.config[col].tooltip; }, setColumnTooltip : function(col, tooltip){ this.config[col].tooltip = tooltip; }, getDataIndex : function(col){ return this.config[col].dataIndex; }, setDataIndex : function(col, dataIndex){ this.config[col].dataIndex = dataIndex; }, findColumnIndex : function(dataIndex){ var c = this.config; for(var i = 0, len = c.length; i < len; i++){ if(c[i].dataIndex == dataIndex){ return i; } } return -1; }, isCellEditable : function(colIndex, rowIndex){ return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false; }, getCellEditor : function(colIndex, rowIndex){ return this.config[colIndex].editor; }, setEditable : function(col, editable){ this.config[col].editable = editable; }, isHidden : function(colIndex){ return this.config[colIndex].hidden; }, isFixed : function(colIndex){ return this.config[colIndex].fixed; }, isResizable : function(colIndex){ return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true; }, setHidden : function(colIndex, hidden){ var c = this.config[colIndex]; if(c.hidden !== hidden){ c.hidden = hidden; this.totalWidth = null; this.fireEvent("hiddenchange", this, colIndex, hidden); } }, setEditor : function(col, editor){ this.config[col].editor = editor; } }); Ext.grid.ColumnModel.defaultRenderer = function(value){ if(typeof value == "string" && value.length < 1){ return "&#160;"; } return value; }; Ext.grid.DefaultColumnModel = Ext.grid.ColumnModel; Ext.grid.AbstractSelectionModel = function(){ this.locked = false; Ext.grid.AbstractSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable, { init : function(grid){ this.grid = grid; this.initEvents(); }, lock : function(){ this.locked = true; }, unlock : function(){ this.locked = false; }, isLocked : function(){ return this.locked; } }); Ext.grid.RowSelectionModel = function(config){ Ext.apply(this, config); this.selections = new Ext.util.MixedCollection(false, function(o){ return o.id; }); this.last = false; this.lastActive = false; this.addEvents( "selectionchange", "beforerowselect", "rowselect", "rowdeselect" ); Ext.grid.RowSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel, { singleSelect : false, initEvents : function(){ if(!this.grid.enableDragDrop && !this.grid.enableDrag){ this.grid.on("rowmousedown", this.handleMouseDown, this); }else{ this.grid.on("rowclick", function(grid, rowIndex, e) { if(e.button === 0 && !e.shiftKey && !e.ctrlKey) { this.selectRow(rowIndex, false); grid.view.focusRow(rowIndex); } }, this); } this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), { "up" : function(e){ if(!e.shiftKey){ this.selectPrevious(e.shiftKey); }else if(this.last !== false && this.lastActive !== false){ var last = this.last; this.selectRange(this.last, this.lastActive-1); this.grid.getView().focusRow(this.lastActive); if(last !== false){ this.last = last; } }else{ this.selectFirstRow(); } }, "down" : function(e){ if(!e.shiftKey){ this.selectNext(e.shiftKey); }else if(this.last !== false && this.lastActive !== false){ var last = this.last; this.selectRange(this.last, this.lastActive+1); this.grid.getView().focusRow(this.lastActive); if(last !== false){ this.last = last; } }else{ this.selectFirstRow(); } }, scope: this }); var view = this.grid.view; view.on("refresh", this.onRefresh, this); view.on("rowupdated", this.onRowUpdated, this); view.on("rowremoved", this.onRemove, this); }, onRefresh : function(){ var ds = this.grid.store, index; var s = this.getSelections(); this.clearSelections(true); for(var i = 0, len = s.length; i < len; i++){ var r = s[i]; if((index = ds.indexOfId(r.id)) != -1){ this.selectRow(index, true); } } if(s.length != this.selections.getCount()){ this.fireEvent("selectionchange", this); } }, onRemove : function(v, index, r){ if(this.selections.remove(r) !== false){ this.fireEvent('selectionchange', this); } }, onRowUpdated : function(v, index, r){ if(this.isSelected(r)){ v.onRowSelect(index); } }, selectRecords : function(records, keepExisting){ if(!keepExisting){ this.clearSelections(); } var ds = this.grid.store; for(var i = 0, len = records.length; i < len; i++){ this.selectRow(ds.indexOf(records[i]), true); } }, getCount : function(){ return this.selections.length; }, selectFirstRow : function(){ this.selectRow(0); }, selectLastRow : function(keepExisting){ this.selectRow(this.grid.store.getCount() - 1, keepExisting); }, selectNext : function(keepExisting){ if(this.hasNext()){ this.selectRow(this.last+1, keepExisting); this.grid.getView().focusRow(this.last); return true; } return false; }, selectPrevious : function(keepExisting){ if(this.hasPrevious()){ this.selectRow(this.last-1, keepExisting); this.grid.getView().focusRow(this.last); return true; } return false; }, hasNext : function(){ return this.last !== false && (this.last+1) < this.grid.store.getCount(); }, hasPrevious : function(){ return !!this.last; }, getSelections : function(){ return [].concat(this.selections.items); }, getSelected : function(){ return this.selections.itemAt(0); }, each : function(fn, scope){ var s = this.getSelections(); for(var i = 0, len = s.length; i < len; i++){ if(fn.call(scope || this, s[i], i) === false){ return false; } } return true; }, clearSelections : function(fast){ if(this.locked) return; if(fast !== true){ var ds = this.grid.store; var s = this.selections; s.each(function(r){ this.deselectRow(ds.indexOfId(r.id)); }, this); s.clear(); }else{ this.selections.clear(); } this.last = false; }, selectAll : function(){ if(this.locked) return; this.selections.clear(); for(var i = 0, len = this.grid.store.getCount(); i < len; i++){ this.selectRow(i, true); } }, hasSelection : function(){ return this.selections.length > 0; }, isSelected : function(index){ var r = typeof index == "number" ? this.grid.store.getAt(index) : index; return (r && this.selections.key(r.id) ? true : false); }, isIdSelected : function(id){ return (this.selections.key(id) ? true : false); }, handleMouseDown : function(g, rowIndex, e){ if(e.button !== 0 || this.isLocked()){ return; }; var view = this.grid.getView(); if(e.shiftKey && this.last !== false){ var last = this.last; this.selectRange(last, rowIndex, e.ctrlKey); this.last = last; view.focusRow(rowIndex); }else{ var isSelected = this.isSelected(rowIndex); if(e.ctrlKey && isSelected){ this.deselectRow(rowIndex); }else if(!isSelected || this.getCount() > 1){ this.selectRow(rowIndex, e.ctrlKey || e.shiftKey); view.focusRow(rowIndex); } } }, selectRows : function(rows, keepExisting){ if(!keepExisting){ this.clearSelections(); } for(var i = 0, len = rows.length; i < len; i++){ this.selectRow(rows[i], true); } }, selectRange : function(startRow, endRow, keepExisting){ if(this.locked) return; if(!keepExisting){ this.clearSelections(); } if(startRow <= endRow){ for(var i = startRow; i <= endRow; i++){ this.selectRow(i, true); } }else{ for(var i = startRow; i >= endRow; i--){ this.selectRow(i, true); } } }, deselectRange : function(startRow, endRow, preventViewNotify){ if(this.locked) return; for(var i = startRow; i <= endRow; i++){ this.deselectRow(i, preventViewNotify); } }, selectRow : function(index, keepExisting, preventViewNotify){ if(this.locked || (index < 0 || index >= this.grid.store.getCount())) return; var r = this.grid.store.getAt(index); if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){ if(!keepExisting || this.singleSelect){ this.clearSelections(); } this.selections.add(r); this.last = this.lastActive = index; if(!preventViewNotify){ this.grid.getView().onRowSelect(index); } this.fireEvent("rowselect", this, index, r); this.fireEvent("selectionchange", this); } }, deselectRow : function(index, preventViewNotify){ if(this.locked) return; if(this.last == index){ this.last = false; } if(this.lastActive == index){ this.lastActive = false; } var r = this.grid.store.getAt(index); if(r){ this.selections.remove(r); if(!preventViewNotify){ this.grid.getView().onRowDeselect(index); } this.fireEvent("rowdeselect", this, index, r); this.fireEvent("selectionchange", this); } }, restoreLast : function(){ if(this._last){ this.last = this._last; } }, acceptsNav : function(row, col, cm){ return !cm.isHidden(col) && cm.isCellEditable(col, row); }, onEditorKey : function(field, e){ var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor; var shift = e.shiftKey; if(k == e.TAB){ e.stopEvent(); ed.completeEdit(); if(shift){ newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this); }else{ newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this); } }else if(k == e.ENTER){ e.stopEvent(); ed.completeEdit(); if(this.moveEditorOnEnter !== false){ if(shift){ newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this); }else{ newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this); } } }else if(k == e.ESC){ ed.cancelEdit(); } if(newCell){ g.startEditing(newCell[0], newCell[1]); } } }); Ext.grid.CellSelectionModel = function(config){ Ext.apply(this, config); this.selection = null; this.addEvents( "beforecellselect", "cellselect", "selectionchange" ); Ext.grid.CellSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel, { initEvents : function(){ this.grid.on("cellmousedown", this.handleMouseDown, this); this.grid.getGridEl().on(Ext.isIE ? "keydown" : "keypress", this.handleKeyDown, this); var view = this.grid.view; view.on("refresh", this.onViewChange, this); view.on("rowupdated", this.onRowUpdated, this); view.on("beforerowremoved", this.clearSelections, this); view.on("beforerowsinserted", this.clearSelections, this); if(this.grid.isEditor){ this.grid.on("beforeedit", this.beforeEdit, this); } }, beforeEdit : function(e){ this.select(e.row, e.column, false, true, e.record); }, onRowUpdated : function(v, index, r){ if(this.selection && this.selection.record == r){ v.onCellSelect(index, this.selection.cell[1]); } }, onViewChange : function(){ this.clearSelections(true); }, getSelectedCell : function(){ return this.selection ? this.selection.cell : null; }, clearSelections : function(preventNotify){ var s = this.selection; if(s){ if(preventNotify !== true){ this.grid.view.onCellDeselect(s.cell[0], s.cell[1]); } this.selection = null; this.fireEvent("selectionchange", this, null); } }, hasSelection : function(){ return this.selection ? true : false; }, handleMouseDown : function(g, row, cell, e){ if(e.button !== 0 || this.isLocked()){ return; }; this.select(row, cell); }, select : function(rowIndex, colIndex, preventViewNotify, preventFocus, r){ if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){ this.clearSelections(); r = r || this.grid.store.getAt(rowIndex); this.selection = { record : r, cell : [rowIndex, colIndex] }; if(!preventViewNotify){ var v = this.grid.getView(); v.onCellSelect(rowIndex, colIndex); if(preventFocus !== true){ v.focusCell(rowIndex, colIndex); } } this.fireEvent("cellselect", this, rowIndex, colIndex); this.fireEvent("selectionchange", this, this.selection); } }, isSelectable : function(rowIndex, colIndex, cm){ return !cm.isHidden(colIndex); }, handleKeyDown : function(e){ if(!e.isNavKeyPress()){ return; } var g = this.grid, s = this.selection; if(!s){ e.stopEvent(); var cell = g.walkCells(0, 0, 1, this.isSelectable, this); if(cell){ this.select(cell[0], cell[1]); } return; } var sm = this; var walk = function(row, col, step){ return g.walkCells(row, col, step, sm.isSelectable, sm); }; var k = e.getKey(), r = s.cell[0], c = s.cell[1]; var newCell; switch(k){ case e.TAB: if(e.shiftKey){ newCell = walk(r, c-1, -1); }else{ newCell = walk(r, c+1, 1); } break; case e.DOWN: newCell = walk(r+1, c, 1); break; case e.UP: newCell = walk(r-1, c, -1); break; case e.RIGHT: newCell = walk(r, c+1, 1); break; case e.LEFT: newCell = walk(r, c-1, -1); break; case e.ENTER: if(g.isEditor && !g.editing){ g.startEditing(r, c); e.stopEvent(); return; } break; }; if(newCell){ this.select(newCell[0], newCell[1]); e.stopEvent(); } }, acceptsNav : function(row, col, cm){ return !cm.isHidden(col) && cm.isCellEditable(col, row); }, onEditorKey : function(field, e){ var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor; if(k == e.TAB){ if(e.shiftKey){ newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this); }else{ newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this); } e.stopEvent(); }else if(k == e.ENTER){ ed.completeEdit(); e.stopEvent(); }else if(k == e.ESC){ e.stopEvent(); ed.cancelEdit(); } if(newCell){ g.startEditing(newCell[0], newCell[1]); } } }); Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { clicksToEdit: 2, isEditor : true, detectEdit: false, autoEncode : false, trackMouseOver: false, initComponent : function(){ Ext.grid.EditorGridPanel.superclass.initComponent.call(this); if(!this.selModel){ this.selModel = new Ext.grid.CellSelectionModel(); } this.activeEditor = null; this.addEvents( "beforeedit", "afteredit", "validateedit" ); }, initEvents : function(){ Ext.grid.EditorGridPanel.superclass.initEvents.call(this); this.on("bodyscroll", this.stopEditing, this, [true]); if(this.clicksToEdit == 1){ this.on("cellclick", this.onCellDblClick, this); }else { if(this.clicksToEdit == 'auto' && this.view.mainBody){ this.view.mainBody.on("mousedown", this.onAutoEditClick, this); } this.on("celldblclick", this.onCellDblClick, this); } this.getGridEl().addClass("xedit-grid"); }, onCellDblClick : function(g, row, col){ this.startEditing(row, col); }, onAutoEditClick : function(e, t){ if(e.button !== 0){ return; } var row = this.view.findRowIndex(t); var col = this.view.findCellIndex(t); if(row !== false && col !== false){ this.stopEditing(); if(this.selModel.getSelectedCell){ var sc = this.selModel.getSelectedCell(); if(sc && sc.cell[0] === row && sc.cell[1] === col){ this.startEditing(row, col); } }else{ if(this.selModel.isSelected(row)){ this.startEditing(row, col); } } } }, onEditComplete : function(ed, value, startValue){ this.editing = false; this.activeEditor = null; ed.un("specialkey", this.selModel.onEditorKey, this.selModel); var r = ed.record; var field = this.colModel.getDataIndex(ed.col); value = this.postEditValue(value, startValue, r, field); if(String(value) !== String(startValue)){ var e = { grid: this, record: r, field: field, originalValue: startValue, value: value, row: ed.row, column: ed.col, cancel:false }; if(this.fireEvent("validateedit", e) !== false && !e.cancel){ r.set(field, e.value); delete e.cancel; this.fireEvent("afteredit", e); } } this.view.focusCell(ed.row, ed.col); }, startEditing : function(row, col){ this.stopEditing(); if(this.colModel.isCellEditable(col, row)){ this.view.ensureVisible(row, col, true); var r = this.store.getAt(row); var field = this.colModel.getDataIndex(col); var e = { grid: this, record: r, field: field, value: r.data[field], row: row, column: col, cancel:false }; if(this.fireEvent("beforeedit", e) !== false && !e.cancel){ this.editing = true; var ed = this.colModel.getCellEditor(col, row); if(!ed.rendered){ ed.render(this.view.getEditorParent(ed)); } (function(){ ed.row = row; ed.col = col; ed.record = r; ed.on("complete", this.onEditComplete, this, {single: true}); ed.on("specialkey", this.selModel.onEditorKey, this.selModel); this.activeEditor = ed; var v = this.preEditValue(r, field); ed.startEdit(this.view.getCell(row, col), v); }).defer(50, this); } } }, preEditValue : function(r, field){ return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(r.data[field]) : r.data[field]; }, postEditValue : function(value, originalValue, r, field){ return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value; }, stopEditing : function(cancel){ if(this.activeEditor){ this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit'](); } this.activeEditor = null; } }); Ext.reg('editorgrid', Ext.grid.EditorGridPanel); Ext.grid.GridEditor = function(field, config){ Ext.grid.GridEditor.superclass.constructor.call(this, field, config); field.monitorTab = false; }; Ext.extend(Ext.grid.GridEditor, Ext.Editor, { alignment: "tl-tl", autoSize: "width", hideEl : false, cls: "x-small-editor x-grid-editor", shim:false, shadow:false }); Ext.grid.PropertyRecord = Ext.data.Record.create([ {name:'name',type:'string'}, 'value' ]); Ext.grid.PropertyStore = function(grid, source){ this.grid = grid; this.store = new Ext.data.Store({ recordType : Ext.grid.PropertyRecord }); this.store.on('update', this.onUpdate, this); if(source){ this.setSource(source); } Ext.grid.PropertyStore.superclass.constructor.call(this); }; Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, { setSource : function(o){ this.source = o; this.store.removeAll(); var data = []; for(var k in o){ if(this.isEditableValue(o[k])){ data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k)); } } this.store.loadRecords({records: data}, {}, true); }, onUpdate : function(ds, record, type){ if(type == Ext.data.Record.EDIT){ var v = record.data['value']; var oldValue = record.modified['value']; if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){ this.source[record.id] = v; record.commit(); this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue); }else{ record.reject(); } } }, getProperty : function(row){ return this.store.getAt(row); }, isEditableValue: function(val){ if(Ext.isDate(val)){ return true; }else if(typeof val == 'object' || typeof val == 'function'){ return false; } return true; }, setValue : function(prop, value){ this.source[prop] = value; this.store.getById(prop).set('value', value); }, getSource : function(){ return this.source; } }); Ext.grid.PropertyColumnModel = function(grid, store){ this.grid = grid; var g = Ext.grid; g.PropertyColumnModel.superclass.constructor.call(this, [ {header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true}, {header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true} ]); this.store = store; this.bselect = Ext.DomHelper.append(document.body, { tag: 'select', cls: 'x-grid-editor x-hide-display', children: [ {tag: 'option', value: 'true', html: 'true'}, {tag: 'option', value: 'false', html: 'false'} ] }); var f = Ext.form; var bfield = new f.Field({ el:this.bselect, bselect : this.bselect, autoShow: true, getValue : function(){ return this.bselect.value == 'true'; } }); this.editors = { 'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})), 'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})), 'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})), 'boolean' : new g.GridEditor(bfield) }; this.renderCellDelegate = this.renderCell.createDelegate(this); this.renderPropDelegate = this.renderProp.createDelegate(this); }; Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, { nameText : 'Name', valueText : 'Value', dateFormat : 'm/j/Y', renderDate : function(dateVal){ return dateVal.dateFormat(this.dateFormat); }, renderBool : function(bVal){ return bVal ? 'true' : 'false'; }, isCellEditable : function(colIndex, rowIndex){ return colIndex == 1; }, getRenderer : function(col){ return col == 1 ? this.renderCellDelegate : this.renderPropDelegate; }, renderProp : function(v){ return this.getPropertyName(v); }, renderCell : function(val){ var rv = val; if(Ext.isDate(val)){ rv = this.renderDate(val); }else if(typeof val == 'boolean'){ rv = this.renderBool(val); } return Ext.util.Format.htmlEncode(rv); }, getPropertyName : function(name){ var pn = this.grid.propertyNames; return pn && pn[name] ? pn[name] : name; }, getCellEditor : function(colIndex, rowIndex){ var p = this.store.getProperty(rowIndex); var n = p.data['name'], val = p.data['value']; if(this.grid.customEditors[n]){ return this.grid.customEditors[n]; } if(Ext.isDate(val)){ return this.editors['date']; }else if(typeof val == 'number'){ return this.editors['number']; }else if(typeof val == 'boolean'){ return this.editors['boolean']; }else{ return this.editors['string']; } } }); Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, { enableColumnMove:false, stripeRows:false, trackMouseOver: false, clicksToEdit:1, enableHdMenu : false, viewConfig : { forceFit:true }, initComponent : function(){ this.customEditors = this.customEditors || {}; this.lastEditRow = null; var store = new Ext.grid.PropertyStore(this); this.propStore = store; var cm = new Ext.grid.PropertyColumnModel(this, store); store.store.sort('name', 'ASC'); this.addEvents( 'beforepropertychange', 'propertychange' ); this.cm = cm; this.ds = store.store; Ext.grid.PropertyGrid.superclass.initComponent.call(this); this.selModel.on('beforecellselect', function(sm, rowIndex, colIndex){ if(colIndex === 0){ this.startEditing.defer(200, this, [rowIndex, 1]); return false; } }, this); }, onRender : function(){ Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments); this.getGridEl().addClass('x-props-grid'); }, afterRender: function(){ Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments); if(this.source){ this.setSource(this.source); } }, setSource : function(source){ this.propStore.setSource(source); }, getSource : function(){ return this.propStore.getSource(); } }); Ext.grid.RowNumberer = function(config){ Ext.apply(this, config); if(this.rowspan){ this.renderer = this.renderer.createDelegate(this); } }; Ext.grid.RowNumberer.prototype = { header: "", width: 23, sortable: false, fixed:true, menuDisabled:true, dataIndex: '', id: 'numberer', rowspan: undefined, renderer : function(v, p, record, rowIndex){ if(this.rowspan){ p.cellAttr = 'rowspan="'+this.rowspan+'"'; } return rowIndex+1; } }; Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, { header: '<div class="x-grid3-hd-checker">&#160;</div>', width: 20, sortable: false, menuDisabled:true, fixed:true, dataIndex: '', id: 'checker', initEvents : function(){ Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this); this.grid.on('render', function(){ var view = this.grid.getView(); view.mainBody.on('mousedown', this.onMouseDown, this); Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this); }, this); }, onMouseDown : function(e, t){ if(e.button === 0 && t.className == 'x-grid3-row-checker'){ e.stopEvent(); var row = e.getTarget('.x-grid3-row'); if(row){ var index = row.rowIndex; if(this.isSelected(index)){ this.deselectRow(index); }else{ this.selectRow(index, true); } } } }, onHdMouseDown : function(e, t){ if(t.className == 'x-grid3-hd-checker'){ e.stopEvent(); var hd = Ext.fly(t.parentNode); var isChecked = hd.hasClass('x-grid3-hd-checker-on'); if(isChecked){ hd.removeClass('x-grid3-hd-checker-on'); this.clearSelections(); }else{ hd.addClass('x-grid3-hd-checker-on'); this.selectAll(); } } }, renderer : function(v, p, record){ return '<div class="x-grid3-row-checker">&#160;</div>'; } }); Ext.LoadMask = function(el, config){ this.el = Ext.get(el); Ext.apply(this, config); if(this.store){ this.store.on('beforeload', this.onBeforeLoad, this); this.store.on('load', this.onLoad, this); this.store.on('loadexception', this.onLoad, this); this.removeMask = Ext.value(this.removeMask, false); }else{ var um = this.el.getUpdater(); um.showLoadIndicator = false; um.on('beforeupdate', this.onBeforeLoad, this); um.on('update', this.onLoad, this); um.on('failure', this.onLoad, this); this.removeMask = Ext.value(this.removeMask, true); } }; Ext.LoadMask.prototype = { msg : 'Loading...', msgCls : 'x-mask-loading', disabled: false, disable : function(){ this.disabled = true; }, enable : function(){ this.disabled = false; }, onLoad : function(){ this.el.unmask(this.removeMask); }, onBeforeLoad : function(){ if(!this.disabled){ this.el.mask(this.msg, this.msgCls); } }, show: function(){ this.onBeforeLoad(); }, hide: function(){ this.onLoad(); }, destroy : function(){ if(this.store){ this.store.un('beforeload', this.onBeforeLoad, this); this.store.un('load', this.onLoad, this); this.store.un('loadexception', this.onLoad, this); }else{ var um = this.el.getUpdater(); um.un('beforeupdate', this.onBeforeLoad, this); um.un('update', this.onLoad, this); um.un('failure', this.onLoad, this); } } }; Ext.ProgressBar = Ext.extend(Ext.BoxComponent, { baseCls : 'x-progress', waitTimer : null, initComponent : function(){ Ext.ProgressBar.superclass.initComponent.call(this); this.addEvents( "update" ); }, onRender : function(ct, position){ Ext.ProgressBar.superclass.onRender.call(this, ct, position); var tpl = new Ext.Template( '<div class="{cls}-wrap">', '<div class="{cls}-inner">', '<div class="{cls}-bar">', '<div class="{cls}-text">', '<div>&#160;</div>', '</div>', '</div>', '<div class="{cls}-text {cls}-text-back">', '<div>&#160;</div>', '</div>', '</div>', '</div>' ); if(position){ this.el = tpl.insertBefore(position, {cls: this.baseCls}, true); }else{ this.el = tpl.append(ct, {cls: this.baseCls}, true); } if(this.id){ this.el.dom.id = this.id; } var inner = this.el.dom.firstChild; this.progressBar = Ext.get(inner.firstChild); if(this.textEl){ this.textEl = Ext.get(this.textEl); delete this.textTopEl; }else{ this.textTopEl = Ext.get(this.progressBar.dom.firstChild); var textBackEl = Ext.get(inner.childNodes[1]); this.textTopEl.setStyle("z-index", 99).addClass('x-hidden'); this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]); this.textEl.setWidth(inner.offsetWidth); } if(this.value){ this.updateProgress(this.value, this.text); }else{ this.updateText(this.text); } this.setSize(this.width || 'auto', 'auto'); this.progressBar.setHeight(inner.offsetHeight); }, updateProgress : function(value, text){ this.value = value || 0; if(text){ this.updateText(text); } var w = Math.floor(value*this.el.dom.firstChild.offsetWidth); this.progressBar.setWidth(w); if(this.textTopEl){ this.textTopEl.removeClass('x-hidden').setWidth(w); } this.fireEvent('update', this, value, text); return this; }, wait : function(o){ if(!this.waitTimer){ var scope = this; o = o || {}; this.waitTimer = Ext.TaskMgr.start({ run: function(i){ var inc = o.increment || 10; this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01); }, interval: o.interval || 1000, duration: o.duration, onStop: function(){ if(o.fn){ o.fn.apply(o.scope || this); } this.reset(); }, scope: scope }); } return this; }, isWaiting : function(){ return this.waitTimer != null; }, updateText : function(text){ this.text = text || '&#160;'; this.textEl.update(this.text); return this; }, setSize : function(w, h){ Ext.ProgressBar.superclass.setSize.call(this, w, h); if(this.textTopEl){ var inner = this.el.dom.firstChild; this.textEl.setSize(inner.offsetWidth, inner.offsetHeight); } return this; }, reset : function(hide){ this.updateProgress(0); if(this.textTopEl){ this.textTopEl.addClass('x-hidden'); } if(this.waitTimer){ this.waitTimer.onStop = null; Ext.TaskMgr.stop(this.waitTimer); this.waitTimer = null; } if(hide === true){ this.hide(); } return this; } }); Ext.reg('progress', Ext.ProgressBar); Ext.debug = {}; (function(){ var cp; function createConsole(){ var scriptPanel = new Ext.debug.ScriptsPanel(); var logView = new Ext.debug.LogPanel(); var tree = new Ext.debug.DomTree(); var tabs = new Ext.TabPanel({ activeTab: 0, border: false, tabPosition: 'bottom', items: [{ title: 'Debug Console', layout:'border', items: [logView, scriptPanel] },{ title: 'DOM Inspector', layout:'border', items: [tree] }] }); cp = new Ext.Panel({ id: 'x-debug-browser', title: 'Console', collapsible: true, animCollapse: false, style: 'position:absolute;left:0;bottom:0;', height:200, logView: logView, layout: 'fit', tools:[{ id: 'close', handler: function(){ cp.destroy(); cp = null; Ext.EventManager.removeResizeListener(handleResize); } }], items: tabs }); cp.render(document.body); cp.resizer = new Ext.Resizable(cp.el, { minHeight:50, handles: "n", pinned: true, transparent:true, resizeElement : function(){ var box = this.proxy.getBox(); this.proxy.hide(); cp.setHeight(box.height); return box; } }); function handleResize(){ cp.setWidth(Ext.getBody().getViewSize().width); } Ext.EventManager.onWindowResize(handleResize); handleResize(); } Ext.apply(Ext, { log : function(){ if(!cp){ createConsole(); } cp.logView.log.apply(cp.logView, arguments); }, logf : function(format, arg1, arg2, etc){ Ext.log(String.format.apply(String, arguments)); }, dump : function(o){ if(typeof o == 'string' || typeof o == 'number' || typeof o == 'undefined' || Ext.isDate(o)){ Ext.log(o); }else if(!o){ Ext.log("null"); }else if(typeof o != "object"){ Ext.log('Unknown return type'); }else if(Ext.isArray(o)){ Ext.log('['+o.join(',')+']'); }else{ var b = ["{\n"]; for(var key in o){ var to = typeof o[key]; if(to != "function" && to != "object"){ b.push(String.format(" {0}: {1},\n", key, o[key])); } } var s = b.join(""); if(s.length > 3){ s = s.substr(0, s.length-2); } Ext.log(s + "\n}"); } }, _timers : {}, time : function(name){ name = name || "def"; Ext._timers[name] = new Date().getTime(); }, timeEnd : function(name, printResults){ var t = new Date().getTime(); name = name || "def"; var v = String.format("{0} ms", t-Ext._timers[name]); Ext._timers[name] = new Date().getTime(); if(printResults !== false){ Ext.log('Timer ' + (name == "def" ? v : name + ": " + v)); } return v; } }); })(); Ext.debug.ScriptsPanel = Ext.extend(Ext.Panel, { id:'x-debug-scripts', region: 'east', minWidth: 200, split: true, width: 350, border: false, layout:'anchor', style:'border-width:0 0 0 1px;', initComponent : function(){ this.scriptField = new Ext.form.TextArea({ anchor: '100% -26', style:'border-width:0;' }); this.trapBox = new Ext.form.Checkbox({ id: 'console-trap', boxLabel: 'Trap Errors', checked: true }); this.toolbar = new Ext.Toolbar([{ text: 'Run', scope: this, handler: this.evalScript },{ text: 'Clear', scope: this, handler: this.clear }, '->', this.trapBox, ' ', ' ' ]); this.items = [this.toolbar, this.scriptField]; Ext.debug.ScriptsPanel.superclass.initComponent.call(this); }, evalScript : function(){ var s = this.scriptField.getValue(); if(this.trapBox.getValue()){ try{ var rt = eval(s); Ext.dump(rt === undefined? '(no return)' : rt); }catch(e){ Ext.log(e.message || e.descript); } }else{ var rt = eval(s); Ext.dump(rt === undefined? '(no return)' : rt); } }, clear : function(){ this.scriptField.setValue(''); this.scriptField.focus(); } }); Ext.debug.LogPanel = Ext.extend(Ext.Panel, { autoScroll: true, region: 'center', border: false, style:'border-width:0 1px 0 0', log : function(){ var markup = [ '<div style="padding:5px !important;border-bottom:1px solid #ccc;">', Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments, ', ')).replace(/\n/g, '<br />').replace(/\s/g, '&#160;'), '</div>'].join(''); this.body.insertHtml('beforeend', markup); this.body.scrollTo('top', 100000); }, clear : function(){ this.body.update(''); this.body.dom.scrollTop = 0; } }); Ext.debug.DomTree = Ext.extend(Ext.tree.TreePanel, { enableDD:false , lines:false, rootVisible:false, animate:false, hlColor:'ffff9c', autoScroll: true, region:'center', border:false, initComponent : function(){ Ext.debug.DomTree.superclass.initComponent.call(this); var styles = false, hnode; var nonSpace = /^\s*$/; var html = Ext.util.Format.htmlEncode; var ellipsis = Ext.util.Format.ellipsis; var styleRe = /\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi; function findNode(n){ if(!n || n.nodeType != 1 || n == document.body || n == document){ return false; } var pn = [n], p = n; while((p = p.parentNode) && p.nodeType == 1 && p.tagName.toUpperCase() != 'HTML'){ pn.unshift(p); } var cn = hnode; for(var i = 0, len = pn.length; i < len; i++){ cn.expand(); cn = cn.findChild('htmlNode', pn[i]); if(!cn){ return false; } } cn.select(); var a = cn.ui.anchor; treeEl.dom.scrollTop = Math.max(0 ,a.offsetTop-10); cn.highlight(); return true; } function nodeTitle(n){ var s = n.tagName; if(n.id){ s += '#'+n.id; }else if(n.className){ s += '.'+n.className; } return s; } function onNodeSelect(t, n, last){ return; if(last && last.unframe){ last.unframe(); } var props = {}; if(n && n.htmlNode){ if(frameEl.pressed){ n.frame(); } if(inspecting){ return; } addStyle.enable(); reload.setDisabled(n.leaf); var dom = n.htmlNode; stylePanel.setTitle(nodeTitle(dom)); if(styles && !showAll.pressed){ var s = dom.style ? dom.style.cssText : ''; if(s){ var m; while ((m = styleRe.exec(s)) != null){ props[m[1].toLowerCase()] = m[2]; } } }else if(styles){ var cl = Ext.debug.cssList; var s = dom.style, fly = Ext.fly(dom); if(s){ for(var i = 0, len = cl.length; i<len; i++){ var st = cl[i]; var v = s[st] || fly.getStyle(st); if(v != undefined && v !== null && v !== ''){ props[st] = v; } } } }else{ for(var a in dom){ var v = dom[a]; if((isNaN(a+10)) && v != undefined && v !== null && v !== '' && !(Ext.isGecko && a[0] == a[0].toUpperCase())){ props[a] = v; } } } }else{ if(inspecting){ return; } addStyle.disable(); reload.disabled(); } stylesGrid.setSource(props); stylesGrid.treeNode = n; stylesGrid.view.fitColumns(); } this.loader = new Ext.tree.TreeLoader(); this.loader.load = function(n, cb){ var isBody = n.htmlNode == document.body; var cn = n.htmlNode.childNodes; for(var i = 0, c; c = cn[i]; i++){ if(isBody && c.id == 'x-debug-browser'){ continue; } if(c.nodeType == 1){ n.appendChild(new Ext.debug.HtmlNode(c)); }else if(c.nodeType == 3 && !nonSpace.test(c.nodeValue)){ n.appendChild(new Ext.tree.TreeNode({ text:'<em>' + ellipsis(html(String(c.nodeValue)), 35) + '</em>', cls: 'x-tree-noicon' })); } } cb(); }; this.root = this.setRootNode(new Ext.tree.TreeNode('Ext')); hnode = this.root.appendChild(new Ext.debug.HtmlNode( document.getElementsByTagName('html')[0] )); } }); Ext.debug.HtmlNode = function(){ var html = Ext.util.Format.htmlEncode; var ellipsis = Ext.util.Format.ellipsis; var nonSpace = /^\s*$/; var attrs = [ {n: 'id', v: 'id'}, {n: 'className', v: 'class'}, {n: 'name', v: 'name'}, {n: 'type', v: 'type'}, {n: 'src', v: 'src'}, {n: 'href', v: 'href'} ]; function hasChild(n){ for(var i = 0, c; c = n.childNodes[i]; i++){ if(c.nodeType == 1){ return true; } } return false; } function renderNode(n, leaf){ var tag = n.tagName.toLowerCase(); var s = '&lt;' + tag; for(var i = 0, len = attrs.length; i < len; i++){ var a = attrs[i]; var v = n[a.n]; if(v && !nonSpace.test(v)){ s += ' ' + a.v + '=&quot;<i>' + html(v) +'</i>&quot;'; } } var style = n.style ? n.style.cssText : ''; if(style){ s += ' style=&quot;<i>' + html(style.toLowerCase()) +'</i>&quot;'; } if(leaf && n.childNodes.length > 0){ s+='&gt;<em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em>&lt;/'+tag+'&gt;'; }else if(leaf){ s += ' /&gt;'; }else{ s += '&gt;'; } return s; } var HtmlNode = function(n){ var leaf = !hasChild(n); this.htmlNode = n; this.tagName = n.tagName.toLowerCase(); var attr = { text : renderNode(n, leaf), leaf : leaf, cls: 'x-tree-noicon' }; HtmlNode.superclass.constructor.call(this, attr); this.attributes.htmlNode = n; if(!leaf){ this.on('expand', this.onExpand, this); this.on('collapse', this.onCollapse, this); } }; Ext.extend(HtmlNode, Ext.tree.AsyncTreeNode, { cls: 'x-tree-noicon', preventHScroll: true, refresh : function(highlight){ var leaf = !hasChild(this.htmlNode); this.setText(renderNode(this.htmlNode, leaf)); if(highlight){ Ext.fly(this.ui.textNode).highlight(); } }, onExpand : function(){ if(!this.closeNode && this.parentNode){ this.closeNode = this.parentNode.insertBefore(new Ext.tree.TreeNode({ text:'&lt;/' + this.tagName + '&gt;', cls: 'x-tree-noicon' }), this.nextSibling); }else if(this.closeNode){ this.closeNode.ui.show(); } }, onCollapse : function(){ if(this.closeNode){ this.closeNode.ui.hide(); } }, render : function(bulkRender){ HtmlNode.superclass.render.call(this, bulkRender); }, highlightNode : function(){ }, highlight : function(){ }, frame : function(){ this.htmlNode.style.border = '1px solid #0000ff'; }, unframe : function(){ this.htmlNode.style.border = ''; } }); return HtmlNode; }();
08to09-processwave
oryx/editor/lib/ext-2.0.2/ext-all-debug.js
JavaScript
mit
947,365
/** * @class Ext.ux.ColorField * @extends Ext.form.TriggerField * Provides a color input field with a {@link Ext.ColorPalette} dropdown. * @constructor * Create a new ColorField * <br />Example: * <pre><code> var color_field = new Ext.ux.ColorField({ fieldLabel: 'Color', id: 'color', width: 175, allowBlank: false }); </code></pre> * @param {Object} config */ Ext.ux.ColorField = Ext.extend(Ext.form.TriggerField, { /** * @cfg {String} invalidText * The error to display when the color in the field is invalid (defaults to * '{value} is not a valid color - it must be in the format {format}'). */ invalidText : "'{0}' is not a valid color - it must be in a the hex format (# followed by 3 or 6 letters/numbers 0-9 A-F)", /** * @cfg {String} triggerClass * An additional CSS class used to style the trigger button. The trigger will always get the * class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified (defaults to 'x-form-color-trigger' * which displays a color wheel icon). */ triggerClass : 'x-form-color-trigger', /** * @cfg {String/Object} autoCreate * A DomHelper element spec, or true for a default element spec (defaults to * {tag: "input", type: "text", size: "10", autocomplete: "off"}) */ // private defaultAutoCreate : {tag: "input", type: "text", size: "10", maxlength: "7", autocomplete: "off"}, // Limit input to hex values maskRe: /[#a-f0-9]/i, facade: undefined, // private validateValue : function(value){ if(!Ext.ux.ColorField.superclass.validateValue.call(this, value)){ return false; } if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid this.setColor(''); return true; } var parseOK = this.parseColor(value); if(!value || (parseOK == false)){ this.markInvalid(String.format(this.invalidText,value)); return false; } this.setColor(value); return true; }, /** * Sets the current color and changes the background. * Does *not* change the value of the field. * @param {String} hex The color value. */ setColor : function(color) { if (color=='' || color==undefined) { if (this.emptyText!='' && this.parseColor(this.emptyText)) color=this.emptyText; else color='transparent'; } if (this.trigger) this.trigger.setStyle( { 'background-color': color }); else { this.on('render',function(){this.setColor(color)},this); } }, // private // Provides logic to override the default TriggerField.validateBlur which just returns true validateBlur : function(){ return !this.menu || !this.menu.isVisible(); }, /** * Returns the current value of the color field * @return {String} value The color value */ getValue : function(){ return Ext.ux.ColorField.superclass.getValue.call(this) || ""; }, /** * Sets the value of the color field. You can pass a string that can be parsed into a valid HTML color * <br />Usage: * <pre><code> colorField.setValue('#FFFFFF'); </code></pre> * @param {String} color The color string */ setValue : function(color){ Ext.ux.ColorField.superclass.setValue.call(this, this.formatColor(color)); this.setColor( this.formatColor(color)); }, // private parseColor : function(value){ return (!value || (value.substring(0,1) != '#')) ? false : (value.length==4 || value.length==7 ); }, // private formatColor : function(value){ if (!value || this.parseColor(value)) return value; if (value.length==3 || value.length==6) { return '#' + value; } return ''; }, // private menuListeners : { select: function(e, c){ this.setValue(c); }, show : function(){ // retain focus styling this.onFocus(); }, hide : function(){ this.focus.defer(10, this); var ml = this.menuListeners; this.menu.un("select", ml.select, this); this.menu.un("show", ml.show, this); this.menu.un("hide", ml.hide, this); } }, // private // Implements the default empty TriggerField.onTriggerClick function to display the ColorPalette onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.ColorMenu(); } this.menu.on(Ext.apply({}, this.menuListeners, { scope:this })); this.menu.show(this.el, "tl-bl?"); } }); Ext.reg('colorfield',Ext.ux.ColorField);
08to09-processwave
oryx/editor/lib/ext-2.0.2/color-field.js
JavaScript
mit
4,958
<?xml version="1.0" encoding="utf-8"?> <project path="" name="Ext - Resources" author="Ext JS, LLC" version="2.0.2" copyright="Ext JS Library $version&#xD;&#xA;Copyright(c) 2006-2008, $author.&#xD;&#xA;licensing@extjs.com&#xD;&#xA;&#xD;&#xA;http://extjs.com/license" output="C:\apps\www\deploy\ext-2.0.2\resources" source="true" source-dir="$output" minify="False" min-dir="$output\build" doc="False" doc-dir="$output\docs" master="true" master-file="$output\yui-ext.js" zip="true" zip-file="$output\yuo-ext.$version.zip"> <directory name="" /> <target name="All css" file="$output\css\ext-all.css" debug="True" shorthand="False" shorthand-list="YAHOO.util.Dom.setStyle&#xD;&#xA;YAHOO.util.Dom.getStyle&#xD;&#xA;YAHOO.util.Dom.getRegion&#xD;&#xA;YAHOO.util.Dom.getViewportHeight&#xD;&#xA;YAHOO.util.Dom.getViewportWidth&#xD;&#xA;YAHOO.util.Dom.get&#xD;&#xA;YAHOO.util.Dom.getXY&#xD;&#xA;YAHOO.util.Dom.setXY&#xD;&#xA;YAHOO.util.CustomEvent&#xD;&#xA;YAHOO.util.Event.addListener&#xD;&#xA;YAHOO.util.Event.getEvent&#xD;&#xA;YAHOO.util.Event.getTarget&#xD;&#xA;YAHOO.util.Event.preventDefault&#xD;&#xA;YAHOO.util.Event.stopEvent&#xD;&#xA;YAHOO.util.Event.stopPropagation&#xD;&#xA;YAHOO.util.Event.stopEvent&#xD;&#xA;YAHOO.util.Anim&#xD;&#xA;YAHOO.util.Motion&#xD;&#xA;YAHOO.util.Connect.asyncRequest&#xD;&#xA;YAHOO.util.Connect.setForm&#xD;&#xA;YAHOO.util.Dom&#xD;&#xA;YAHOO.util.Event"> <include name="css\reset.css" /> <include name="css\core.css" /> <include name="css\tabs.css" /> <include name="css\form.css" /> <include name="css\button.css" /> <include name="css\toolbar.css" /> <include name="css\resizable.css" /> <include name="css\grid.css" /> <include name="css\dd.css" /> <include name="css\tree.css" /> <include name="css\date-picker.css" /> <include name="css\qtips.css" /> <include name="css\menu.css" /> <include name="css\box.css" /> <include name="css\debug.css" /> <include name="css\combo.css" /> <include name="css\panel.css" /> <include name="css\window.css" /> <include name="css\editor.css" /> <include name="css\borders.css" /> <include name="css\layout.css" /> <include name="css\progress.css" /> <include name="css\dialog.css" /> </target> <file name="images\basic-dialog\gray\close.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\dlg-bg.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\e-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\hd-sprite.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\s-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\se-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\btn-sprite.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\close.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\e-handle.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\hd-sprite.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\s-handle.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\se-handle.gif" path="images\basic-dialog" /> <file name="images\grid\arrow-left-white.gif" path="images\grid" /> <file name="images\grid\arrow-right-white.gif" path="images\grid" /> <file name="images\grid\done.gif" path="images\grid" /> <file name="images\grid\drop-no.gif" path="images\grid" /> <file name="images\grid\drop-yes.gif" path="images\grid" /> <file name="images\grid\footer-bg.gif" path="images\grid" /> <file name="images\grid\grid-blue-hd.gif" path="images\grid" /> <file name="images\grid\grid-blue-split.gif" path="images\grid" /> <file name="images\grid\grid-loading.gif" path="images\grid" /> <file name="images\grid\grid-split.gif" path="images\grid" /> <file name="images\grid\grid-vista-hd.gif" path="images\grid" /> <file name="images\grid\invalid_line.gif" path="images\grid" /> <file name="images\grid\loading.gif" path="images\grid" /> <file name="images\grid\mso-hd.gif" path="images\grid" /> <file name="images\grid\nowait.gif" path="images\grid" /> <file name="images\grid\page-first-disabled.gif" path="images\grid" /> <file name="images\grid\page-first.gif" path="images\grid" /> <file name="images\grid\page-last-disabled.gif" path="images\grid" /> <file name="images\grid\page-last.gif" path="images\grid" /> <file name="images\grid\page-next-disabled.gif" path="images\grid" /> <file name="images\grid\page-next.gif" path="images\grid" /> <file name="images\grid\page-prev-disabled.gif" path="images\grid" /> <file name="images\grid\page-prev.gif" path="images\grid" /> <file name="images\grid\pick-button.gif" path="images\grid" /> <file name="images\grid\refresh.gif" path="images\grid" /> <file name="images\grid\sort_asc.gif" path="images\grid" /> <file name="images\grid\sort_desc.gif" path="images\grid" /> <file name="images\grid\wait.gif" path="images\grid" /> <file name="images\layout\gray\collapse.gif" path="images\layout\gray" /> <file name="images\layout\gray\expand.gif" path="images\layout\gray" /> <file name="images\layout\gray\gradient-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\ns-collapse.gif" path="images\layout\gray" /> <file name="images\layout\gray\ns-expand.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-close.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-title-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-title-light-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\screenshot.gif" path="images\layout\gray" /> <file name="images\layout\gray\tab-close-on.gif" path="images\layout\gray" /> <file name="images\layout\gray\tab-close.gif" path="images\layout\gray" /> <file name="images\layout\collapse.gif" path="images\layout" /> <file name="images\layout\expand.gif" path="images\layout" /> <file name="images\layout\gradient-bg.gif" path="images\layout" /> <file name="images\layout\ns-collapse.gif" path="images\layout" /> <file name="images\layout\ns-expand.gif" path="images\layout" /> <file name="images\layout\panel-close.gif" path="images\layout" /> <file name="images\layout\panel-title-bg.gif" path="images\layout" /> <file name="images\layout\panel-title-light-bg.gif" path="images\layout" /> <file name="images\layout\tab-close-on.gif" path="images\layout" /> <file name="images\layout\tab-close.gif" path="images\layout" /> <file name="images\sizer\gray\e-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\e-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\ne-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\ne-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\nw-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\nw-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\s-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\s-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\se-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\se-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\sw-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\sw-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\e-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\e-handle.gif" path="images\sizer" /> <file name="images\sizer\ne-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\ne-handle.gif" path="images\sizer" /> <file name="images\sizer\nw-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\nw-handle.gif" path="images\sizer" /> <file name="images\sizer\s-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\s-handle.gif" path="images\sizer" /> <file name="images\sizer\se-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\se-handle.gif" path="images\sizer" /> <file name="images\sizer\square.gif" path="images\sizer" /> <file name="images\sizer\sw-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\sw-handle.gif" path="images\sizer" /> <file name="images\tabs\gray\tab-btm-inactive-left-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-inactive-right-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-left-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-right-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-sprite.gif" path="images\tabs\gray" /> <file name="images\tabs\tab-btm-inactive-left-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-inactive-right-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-left-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-right-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-sprite.gif" path="images\tabs" /> <file name="images\toolbar\gray-bg.gif" path="images\toolbar" /> <file name="images\gradient-bg.gif" path="images" /> <file name="images\s.gif" path="images" /> <file name="images\toolbar\btn-over-bg.gif" path="images\toolbar" /> <file name="images\dd\drop-add.gif" path="images\dd" /> <file name="images\dd\drop-no.gif" path="images\dd" /> <file name="images\dd\drop-yes.gif" path="images\dd" /> <file name="images\qtip\bg.gif" path="images\qtip" /> <file name="images\tree\drop-add.gif" path="images\tree" /> <file name="images\tree\drop-between.gif" path="images\tree" /> <file name="images\tree\drop-no.gif" path="images\tree" /> <file name="images\tree\drop-over.gif" path="images\tree" /> <file name="images\tree\drop-under.gif" path="images\tree" /> <file name="images\tree\drop-yes.gif" path="images\tree" /> <file name="images\tree\elbow-end-minus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-end-minus.gif" path="images\tree" /> <file name="images\tree\elbow-end-plus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-end-plus.gif" path="images\tree" /> <file name="images\tree\elbow-end.gif" path="images\tree" /> <file name="images\tree\elbow-line.gif" path="images\tree" /> <file name="images\tree\elbow-minus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-minus.gif" path="images\tree" /> <file name="images\tree\elbow-plus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-plus.gif" path="images\tree" /> <file name="images\tree\elbow.gif" path="images\tree" /> <file name="images\tree\folder-open.gif" path="images\tree" /> <file name="images\tree\folder.gif" path="images\tree" /> <file name="images\tree\leaf.gif" path="images\tree" /> <file name="images\tree\s.gif" path="images\tree" /> <file name="images\qtip\gray\bg.gif" path="images\qtip\gray" /> <file name="css\aero.css" path="css" /> <file name="images\grid\grid-hrow.gif" path="images\grid" /> <file name="images\aero\toolbar\gray-bg.gif" path="images\aero\toolbar" /> <file name="css\basic-dialog.css" path="css" /> <file name="css\button.css" path="css" /> <file name="css\core.css" path="css" /> <file name="css\dd.css" path="css" /> <file name="css\grid.css" path="css" /> <file name="css\inline-editor.css" path="css" /> <file name="css\layout.css" path="css" /> <file name="css\qtips.css" path="css" /> <file name="css\reset-min.css" path="css" /> <file name="css\resizable.css" path="css" /> <file name="css\tabs.css" path="css" /> <file name="css\toolbar.css" path="css" /> <file name="css\tree.css" path="css" /> <file name="css\ytheme-aero.css" path="css" /> <file name="css\ytheme-gray.css" path="css" /> <file name="css\ytheme-vista.css" path="css" /> <file name="images\aero\basic-dialog\aero-close-over.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\aero-close.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-center.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-left.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-right.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\close.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\dlg-bg.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\e-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\hd-sprite.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\s-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\se-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\w-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\grid\grid-blue-split.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-hrow.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-split.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-vista-hd.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort-col-bg.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort_asc.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort_desc.gif" path="images\aero\grid" /> <file name="images\aero\layout\collapse.gif" path="images\aero\layout" /> <file name="images\aero\layout\expand.gif" path="images\aero\layout" /> <file name="images\aero\layout\gradient-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\ns-collapse.gif" path="images\aero\layout" /> <file name="images\aero\layout\ns-expand.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-close.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-title-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-title-light-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\tab-close-on.gif" path="images\aero\layout" /> <file name="images\aero\layout\tab-close.gif" path="images\aero\layout" /> <file name="images\aero\qtip\bg.gif" path="images\aero\qtip" /> <file name="images\aero\sizer\e-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\e-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\ne-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\ne-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\nw-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\nw-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\s-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\s-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\se-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\se-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\sw-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\sw-handle.gif" path="images\aero\sizer" /> <file name="images\aero\tabs\tab-btm-inactive-left-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-inactive-right-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-left-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-right-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-sprite.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-bg.png" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-btm-bg.gif" path="images\aero\tabs" /> <file name="images\aero\toolbar\bg.gif" path="images\aero\toolbar" /> <file name="images\aero\gradient-bg.gif" path="images\aero" /> <file name="images\aero\s.gif" path="images\aero" /> <file name="images\default\basic-dialog\btn-sprite.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\close.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\e-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\hd-sprite.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\progress.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\progress2.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\s-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\se-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\dd\drop-add.gif" path="images\default\dd" /> <file name="images\default\dd\drop-no.gif" path="images\default\dd" /> <file name="images\default\dd\drop-yes.gif" path="images\default\dd" /> <file name="images\default\grid\arrow-left-white.gif" path="images\default\grid" /> <file name="images\default\grid\arrow-right-white.gif" path="images\default\grid" /> <file name="images\default\grid\done.gif" path="images\default\grid" /> <file name="images\default\grid\drop-no.gif" path="images\default\grid" /> <file name="images\default\grid\drop-yes.gif" path="images\default\grid" /> <file name="images\default\grid\footer-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid-blue-hd.gif" path="images\default\grid" /> <file name="images\default\grid\grid-blue-split.gif" path="images\default\grid" /> <file name="images\default\grid\grid-hrow.gif" path="images\default\grid" /> <file name="images\default\grid\grid-loading.gif" path="images\default\grid" /> <file name="images\default\grid\grid-split.gif" path="images\default\grid" /> <file name="images\default\grid\grid-vista-hd.gif" path="images\default\grid" /> <file name="images\default\grid\invalid_line.gif" path="images\default\grid" /> <file name="images\default\grid\loading.gif" path="images\default\grid" /> <file name="images\default\grid\mso-hd.gif" path="images\default\grid" /> <file name="images\default\grid\nowait.gif" path="images\default\grid" /> <file name="images\default\grid\page-first-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-first.gif" path="images\default\grid" /> <file name="images\default\grid\page-last-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-last.gif" path="images\default\grid" /> <file name="images\default\grid\page-next-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-next.gif" path="images\default\grid" /> <file name="images\default\grid\page-prev-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-prev.gif" path="images\default\grid" /> <file name="images\default\grid\pick-button.gif" path="images\default\grid" /> <file name="images\default\grid\refresh.gif" path="images\default\grid" /> <file name="images\default\grid\sort_asc.gif" path="images\default\grid" /> <file name="images\default\grid\sort_desc.gif" path="images\default\grid" /> <file name="images\default\grid\wait.gif" path="images\default\grid" /> <file name="images\default\layout\collapse.gif" path="images\default\layout" /> <file name="images\default\layout\expand.gif" path="images\default\layout" /> <file name="images\default\layout\gradient-bg.gif" path="images\default\layout" /> <file name="images\default\layout\ns-collapse.gif" path="images\default\layout" /> <file name="images\default\layout\ns-expand.gif" path="images\default\layout" /> <file name="images\default\layout\panel-close.gif" path="images\default\layout" /> <file name="images\default\layout\panel-title-bg.gif" path="images\default\layout" /> <file name="images\default\layout\panel-title-light-bg.gif" path="images\default\layout" /> <file name="images\default\layout\tab-close-on.gif" path="images\default\layout" /> <file name="images\default\layout\tab-close.gif" path="images\default\layout" /> <file name="images\default\qtip\bg.gif" path="images\default\qtip" /> <file name="images\default\sizer\e-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\e-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\ne-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\ne-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\nw-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\nw-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\s-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\s-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\se-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\se-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\square.gif" path="images\default\sizer" /> <file name="images\default\sizer\sw-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\sw-handle.gif" path="images\default\sizer" /> <file name="images\default\tabs\tab-btm-inactive-left-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-inactive-right-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-left-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-right-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-sprite.gif" path="images\default\tabs" /> <file name="images\default\toolbar\btn-over-bg.gif" path="images\default\toolbar" /> <file name="images\default\toolbar\gray-bg.gif" path="images\default\toolbar" /> <file name="images\default\tree\drop-add.gif" path="images\default\tree" /> <file name="images\default\tree\drop-between.gif" path="images\default\tree" /> <file name="images\default\tree\drop-no.gif" path="images\default\tree" /> <file name="images\default\tree\drop-over.gif" path="images\default\tree" /> <file name="images\default\tree\drop-under.gif" path="images\default\tree" /> <file name="images\default\tree\drop-yes.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-minus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-minus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-plus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-plus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-line.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-minus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-minus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-plus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-plus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow.gif" path="images\default\tree" /> <file name="images\default\tree\folder-open.gif" path="images\default\tree" /> <file name="images\default\tree\folder.gif" path="images\default\tree" /> <file name="images\default\tree\leaf.gif" path="images\default\tree" /> <file name="images\default\tree\loading.gif" path="images\default\tree" /> <file name="images\default\tree\s.gif" path="images\default\tree" /> <file name="images\default\gradient-bg.gif" path="images\default" /> <file name="images\default\s.gif" path="images\default" /> <file name="images\gray\basic-dialog\close.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\dlg-bg.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\e-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\hd-sprite.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\s-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\se-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\layout\collapse.gif" path="images\gray\layout" /> <file name="images\gray\layout\expand.gif" path="images\gray\layout" /> <file name="images\gray\layout\gradient-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\ns-collapse.gif" path="images\gray\layout" /> <file name="images\gray\layout\ns-expand.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-close.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-title-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-title-light-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\tab-close-on.gif" path="images\gray\layout" /> <file name="images\gray\layout\tab-close.gif" path="images\gray\layout" /> <file name="images\gray\qtip\bg.gif" path="images\gray\qtip" /> <file name="images\gray\sizer\e-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\e-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\ne-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\ne-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\nw-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\nw-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\s-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\s-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\se-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\se-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\sw-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\sw-handle.gif" path="images\gray\sizer" /> <file name="images\gray\tabs\tab-btm-inactive-left-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-inactive-right-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-left-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-right-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-sprite.gif" path="images\gray\tabs" /> <file name="images\gray\toolbar\gray-bg.gif" path="images\gray\toolbar" /> <file name="images\gray\gradient-bg.gif" path="images\gray" /> <file name="images\gray\s.gif" path="images\gray" /> <file name="images\vista\basic-dialog\bg-center.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\bg-left.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\bg-right.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\close.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\dlg-bg.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\e-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\hd-sprite.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\s-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\se-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\w-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\grid\grid-split.gif" path="images\vista\grid" /> <file name="images\vista\grid\grid-vista-hd.gif" path="images\vista\grid" /> <file name="images\vista\layout\collapse.gif" path="images\vista\layout" /> <file name="images\vista\layout\expand.gif" path="images\vista\layout" /> <file name="images\vista\layout\gradient-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\ns-collapse.gif" path="images\vista\layout" /> <file name="images\vista\layout\ns-expand.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-close.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-title-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-title-light-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\tab-close-on.gif" path="images\vista\layout" /> <file name="images\vista\layout\tab-close.gif" path="images\vista\layout" /> <file name="images\vista\qtip\bg.gif" path="images\vista\qtip" /> <file name="images\vista\sizer\e-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\e-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\ne-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\ne-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\nw-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\nw-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\s-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\s-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\se-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\se-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\sw-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\sw-handle.gif" path="images\vista\sizer" /> <file name="images\vista\tabs\tab-btm-inactive-left-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-inactive-right-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-left-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-right-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-sprite.gif" path="images\vista\tabs" /> <file name="images\vista\toolbar\gray-bg.gif" path="images\vista\toolbar" /> <file name="images\vista\gradient-bg.gif" path="images\vista" /> <file name="images\vista\s.gif" path="images\vista" /> <file name="images\default\grid\col-move.gif" path="images\default\grid" /> <file name="images\default\grid\col-move-bottom.gif" path="images\default\grid" /> <file name="images\default\grid\col-move-top.gif" path="images\default\grid" /> <file name="images\default\basic-dialog\btn-arrow.gif" path="images\default\basic-dialog" /> <file name="images\default\toolbar\tb-btn-sprite.gif" path="images\default\toolbar" /> <file name="images\aero\toolbar\tb-btn-sprite.gif" path="images\aero\toolbar" /> <file name="images\vista\toolbar\tb-btn-sprite.gif" path="images\vista\toolbar" /> <file name="images\default\toolbar\btn-arrow.gif" path="images\default\toolbar" /> <file name="images\default\menu\menu.gif" path="images\default\menu" /> <file name="images\default\menu\unchecked.gif" path="images\default\menu" /> <file name="images\default\menu\checked.gif" path="images\default\menu" /> <file name="images\default\menu\menu-parent.gif" path="images\default\menu" /> <file name="images\default\menu\group-checked.gif" path="images\default\menu" /> <file name="css\menu.css" path="css" /> <file name="css\grid2.css" path="css" /> <file name="css\README.txt" path="css" /> <file name="images\default\grid\hmenu-asc.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-desc.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-lock.png" path="images\default\grid" /> <file name="images\default\grid\hmenu-unlock.png" path="images\default\grid" /> <file name="images\default\grid\Thumbs.db" path="images\default\grid" /> <file name="images\default\menu\shadow-lite.png" path="images\default\menu" /> <file name="images\default\menu\shadow.png" path="images\default\menu" /> <file name="license.txt" path="" /> <file name="css\date-picker.css" path="css" /> <file name="images\default\basic-dialog\collapse.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\expand.gif" path="images\default\basic-dialog" /> <file name="images\aero\basic-dialog\collapse.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\collapse-over.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\expand.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\expand-over.gif" path="images\aero\basic-dialog" /> <file name="images\gray\basic-dialog\collapse.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\expand.gif" path="images\gray\basic-dialog" /> <file name="images\vista\basic-dialog\collapse.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\expand.gif" path="images\vista\basic-dialog" /> <file name="css\.DS_Store" path="css" /> <file name="images\default\grid\.DS_Store" path="images\default\grid" /> <file name="images\default\toolbar\btn-arrow-light.gif" path="images\default\toolbar" /> <file name="images\default\.DS_Store" path="images\default" /> <file name="images\default\shared\left-btn.gif" path="images\default\shared" /> <file name="images\default\shared\right-btn.gif" path="images\default\shared" /> <file name="images\default\shared\calendar.gif" path="images\default\shared" /> <file name="css\form.css" path="css" /> <file name="images\aero\grid\pspbrwse.jbf" path="images\aero\grid" /> <file name="images\default\bg.png" path="images\default" /> <file name="images\default\shadow.png" path="images\default" /> <file name="images\default\shadow-lr.png" path="images\default" /> <file name="images\.DS_Store" path="images" /> <file name=".DS_Store" path="" /> <file name="yui-ext-resources.jsb" path="" /> <file name="resources.jsb" path="" /> <file name="css\box.css" path="css" /> <file name="images\default\box\.DS_Store" path="images\default\box" /> <file name="images\default\box\corners-blue.gif" path="images\default\box" /> <file name="images\default\box\corners.gif" path="images\default\box" /> <file name="images\default\box\l-blue.gif" path="images\default\box" /> <file name="images\default\box\l.gif" path="images\default\box" /> <file name="images\default\box\r-blue.gif" path="images\default\box" /> <file name="images\default\box\r.gif" path="images\default\box" /> <file name="images\default\box\tb-blue.gif" path="images\default\box" /> <file name="images\default\box\tb.gif" path="images\default\box" /> <file name="images\gray\menu\checked.gif" path="images\gray\menu" /> <file name="images\gray\menu\group-checked.gif" path="images\gray\menu" /> <file name="images\gray\menu\menu-parent.gif" path="images\gray\menu" /> <file name="images\gray\menu\menu.gif" path="images\gray\menu" /> <file name="images\gray\menu\unchecked.gif" path="images\gray\menu" /> <file name="images\default\layout\stick.gif" path="images\default\layout" /> <file name="images\default\layout\stuck.gif" path="images\default\layout" /> <file name="images\gray\layout\stick.gif" path="images\gray\layout" /> <file name="images\vista\layout\stick.gif" path="images\vista\layout" /> <file name="images\gray\grid\grid-hrow.gif" path="images\gray\grid" /> <file name="images\default\toolbar\tb-bg.gif" path="images\default\toolbar" /> <file name="images\gray\toolbar\tb-btn-sprite.gif" path="images\gray\toolbar" /> <file name="css\debug.css" path="css" /> <file name="images\default\form\trigger.gif" path="images\default\form" /> <file name="css\combo.css" path="css" /> <file name="images\default\form\date-trigger.gif" path="images\default\form" /> <file name="images\default\shared\warning.gif" path="images\default\shared" /> <file name="images\default\grid\dirty.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-lock.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-unlock.gif" path="images\default\grid" /> <file name="images\default\form\text-bg.gif" path="images\default\form" /> <file name="images\default\form\exclamation.png" path="images\default\form" /> <file name="images\default\form\exclamation.gif" path="images\default\form" /> <file name="images\default\form\error-tip-bg.gif" path="images\default\form" /> <file name="images\default\form\error-tip-corners.gif" path="images\default\form" /> <file name="images\default\qtip\tip-sprite.gif" path="images\default\qtip" /> <file name="images\default\qtip\close.gif" path="images\default\qtip" /> <file name="images\gray\qtip\tip-sprite.gif" path="images\gray\qtip" /> <file name="images\vista\qtip\tip-sprite.gif" path="images\vista\qtip" /> <file name="images\default\grid\hd-pop.gif" path="images\default\grid" /> <file name="css\panel.css" path="css" /> <file name="images\default\panel\panel-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\panel-blue-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\toggle-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\close-sprite.gif" path="images\default\panel" /> <file name="images\default\window\corners-sprite.gif" path="images\default\window" /> <file name="images\default\window\left-right.gif" path="images\default\window" /> <file name="images\default\window\top-bottom.gif" path="images\default\window" /> <file name="css\window.css" path="css" /> <file name="images\default\window\corners-sprite.png" path="images\default\window" /> <file name="images\default\window\corners-sprite.psd" path="images\default\window" /> <file name="images\default\shadow-c.png" path="images\default" /> <file name="css\grid3.css" path="css" /> <file name="css\layout2.css" path="css" /> <file name="css\tabs2.css" path="css" /> <file name="images\default\panel\corners-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\left-right.gif" path="images\default\panel" /> <file name="images\default\panel\tool-sprite-tpl.gif" path="images\default\panel" /> <file name="images\default\panel\tool-sprites.gif" path="images\default\panel" /> <file name="images\default\panel\top-bottom.gif" path="images\default\panel" /> <file name="images\default\panel\top-bottom.png" path="images\default\panel" /> <file name="images\default\panel\white-corners-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\white-left-right.gif" path="images\default\panel" /> <file name="images\default\panel\white-top-bottom.gif" path="images\default\panel" /> <file name="images\default\window\left-corners.png" path="images\default\window" /> <file name="images\default\window\left-corners.psd" path="images\default\window" /> <file name="images\default\window\left-right.png" path="images\default\window" /> <file name="images\default\window\left-right.psd" path="images\default\window" /> <file name="images\default\window\right-corners.png" path="images\default\window" /> <file name="images\default\window\right-corners.psd" path="images\default\window" /> <file name="images\default\window\top-bottom.png" path="images\default\window" /> <file name="images\default\window\top-bottom.psd" path="images\default\window" /> <file name="images\default\._.DS_Store" path="images\default" /> <file name="images\._.DS_Store" path="images" /> <file name="._.DS_Store" path="" /> <file name="css\editor.css" path="css" /> <file name="images\default\editor\tb-sprite.gif" path="images\default\editor" /> <file name="css\borders.css" path="css" /> <file name="images\default\form\clear-trigger.gif" path="images\default\form" /> <file name="images\default\form\search-trigger.gif" path="images\default\form" /> <file name="images\default\form\trigger-tpl.gif" path="images\default\form" /> <file name="images\default\grid\row-over.gif" path="images\default\grid" /> <file name="images\default\grid\row-sel.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hrow.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hrow-over.gif" path="images\default\grid" /> <file name="images\default\grid\row-collapse.gif" path="images\default\grid" /> <file name="images\default\grid\row-expand.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hd-btn.gif" path="images\default\grid" /> <file name="images\aero\menu\menu.gif" path="images\aero\menu" /> <file name="images\aero\menu\item-over.gif" path="images\aero\menu" /> <file name="images\aero\menu\checked.gif" path="images\aero\menu" /> <file name="images\aero\menu\unchecked.gif" path="images\aero\menu" /> <file name="images\default\grid\grid3-expander-b-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-expander-c-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-special-col-bg.gif" path="images\default\grid" /> <file name="images\default\grid\row-expand-sprite.gif" path="images\default\grid" /> <file name="images\default\grid\row-check-sprite.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-special-col-sel-bg.gif" path="images\default\grid" /> <file name="images\default\shared\glass-bg.gif" path="images\default\shared" /> <file name="legacy\grid.css" path="legacy" /> <file name="css\xtheme-aero.css" path="css" /> <file name="css\xtheme-gray.css" path="css" /> <file name="css\xtheme-vista.css" path="css" /> <file name="legacy\basic-dialog.css" path="legacy" /> <file name="images\default\form\clear-trigger.psd" path="images\default\form" /> <file name="images\default\form\date-trigger.psd" path="images\default\form" /> <file name="images\default\form\search-trigger.psd" path="images\default\form" /> <file name="images\default\form\trigger.psd" path="images\default\form" /> <file name="images\aero\tabs\tab-close.gif" path="images\aero\tabs" /> <file name="images\default\panel\light-hd.gif" path="images\default\panel" /> <file name="images\default\panel\tools-sprites-trans.gif" path="images\default\panel" /> <file name="images\aero\tabs\scroller-bg.gif" path="images\aero\tabs" /> <file name="images\default\tabs\scroller-bg.gif" path="images\default\tabs" /> <file name="images\default\grid\group-expand-sprite.gif" path="images\default\grid" /> <file name="images\default\grid\group-by.gif" path="images\default\grid" /> <file name="images\default\grid\columns.gif" path="images\default\grid" /> <file name="css\dialog.css" path="css" /> <file name="images\default\basic-dialog\icon-error.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\icon-info.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\icon-question.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\icon-warning.gif" path="images\default\basic-dialog" /> <file name="css\progress.css" path="css" /> <file name="images\default\widgets\progress-bg.gif" path="images\default\widgets" /> <file name="images\default\progress\progress-bg.gif" path="images\default\progress" /> <file name="images\default\layout\mini-bottom.gif" path="images\default\layout" /> <file name="images\default\layout\mini-left.gif" path="images\default\layout" /> <file name="images\default\layout\mini-right.gif" path="images\default\layout" /> <file name="images\default\layout\mini-top.gif" path="images\default\layout" /> <file name="images\default\shared\blue-loading.gif" path="images\default\shared" /> <file name="images\default\shared\large-loading.gif" path="images\default\shared" /> <file name="images\default\menu\item-over.gif" path="images\default\menu" /> <file name="images\default\tabs\tab-close.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-strip-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-strip-bg.png" path="images\default\tabs" /> <file name="images\default\tabs\tab-strip-btm-bg.gif" path="images\default\tabs" /> <file name="images\default\toolbar\bg.gif" path="images\default\toolbar" /> <file name="images\default\button\btn-arrow.gif" path="images\default\button" /> <file name="images\default\button\btn-sprite.gif" path="images\default\button" /> <file name="images\default\shared\hd-sprite.gif" path="images\default\shared" /> <file name="images\default\window\icon-error.gif" path="images\default\window" /> <file name="images\default\window\icon-info.gif" path="images\default\window" /> <file name="images\default\window\icon-question.gif" path="images\default\window" /> <file name="images\default\window\icon-warning.gif" path="images\default\window" /> <file name="images\gray\panel\corners-sprite.gif" path="images\gray\panel" /> <file name="images\gray\panel\left-right.gif" path="images\gray\panel" /> <file name="images\gray\panel\light-hd.gif" path="images\gray\panel" /> <file name="images\gray\panel\tool-sprite-tpl.gif" path="images\gray\panel" /> <file name="images\gray\panel\tool-sprites.gif" path="images\gray\panel" /> <file name="images\gray\panel\tools-sprites-trans.gif" path="images\gray\panel" /> <file name="images\gray\panel\top-bottom.gif" path="images\gray\panel" /> <file name="images\gray\panel\top-bottom.png" path="images\gray\panel" /> <file name="images\gray\panel\white-corners-sprite.gif" path="images\gray\panel" /> <file name="images\gray\panel\white-left-right.gif" path="images\gray\panel" /> <file name="images\gray\panel\white-top-bottom.gif" path="images\gray\panel" /> <file name="images\gray\qtip\close.gif" path="images\gray\qtip" /> <file name="images\gray\toolbar\bg.gif" path="images\gray\toolbar" /> <file name="images\gray\toolbar\btn-arrow-light.gif" path="images\gray\toolbar" /> <file name="images\gray\toolbar\btn-arrow.gif" path="images\gray\toolbar" /> <file name="images\gray\toolbar\btn-over-bg.gif" path="images\gray\toolbar" /> <file name="images\gray\toolbar\tb-bg.gif" path="images\gray\toolbar" /> <file name="images\gray\tabs\scroller-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-close.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-strip-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-strip-bg.png" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-strip-btm-bg.gif" path="images\gray\tabs" /> <file name="images\gray\window\icon-error.gif" path="images\gray\window" /> <file name="images\gray\window\icon-info.gif" path="images\gray\window" /> <file name="images\gray\window\icon-question.gif" path="images\gray\window" /> <file name="images\gray\window\icon-warning.gif" path="images\gray\window" /> <file name="images\gray\window\left-corners.png" path="images\gray\window" /> <file name="images\gray\window\left-corners.psd" path="images\gray\window" /> <file name="images\gray\window\left-right.png" path="images\gray\window" /> <file name="images\gray\window\left-right.psd" path="images\gray\window" /> <file name="images\gray\window\right-corners.png" path="images\gray\window" /> <file name="images\gray\window\right-corners.psd" path="images\gray\window" /> <file name="images\gray\window\top-bottom.png" path="images\gray\window" /> <file name="images\gray\window\top-bottom.psd" path="images\gray\window" /> <file name="images\gray\button\btn-arrow.gif" path="images\gray\button" /> <file name="images\gray\button\btn-sprite.gif" path="images\gray\button" /> <file name="css\xtheme-gray-blue.css" path="css" /> <file name="images\gray\window\left-corners.pspimage" path="images\gray\window" /> <file name="images\gray\window\right-corners.pspimage" path="images\gray\window" /> <file name="images\default\tabs\tabs-sprite.gif" path="images\default\tabs" /> <file name="images\gray\tabs\tabs-sprite.gif" path="images\gray\tabs" /> <file name="css\xtheme-dark.css" path="css" /> <file name="images\dark\button\btn-arrow.gif" path="images\dark\button" /> <file name="images\dark\button\btn-sprite.gif" path="images\dark\button" /> <file name="images\dark\panel\corners-sprite.gif" path="images\dark\panel" /> <file name="images\dark\panel\left-right.gif" path="images\dark\panel" /> <file name="images\dark\panel\light-hd.gif" path="images\dark\panel" /> <file name="images\dark\panel\tool-sprite-tpl.gif" path="images\dark\panel" /> <file name="images\dark\panel\tool-sprites.gif" path="images\dark\panel" /> <file name="images\dark\panel\tools-sprites-trans.gif" path="images\dark\panel" /> <file name="images\dark\panel\top-bottom.gif" path="images\dark\panel" /> <file name="images\dark\panel\top-bottom.png" path="images\dark\panel" /> <file name="images\dark\panel\white-corners-sprite.gif" path="images\dark\panel" /> <file name="images\dark\panel\white-left-right.gif" path="images\dark\panel" /> <file name="images\dark\panel\white-top-bottom.gif" path="images\dark\panel" /> <file name="images\dark\qtip\bg.gif" path="images\dark\qtip" /> <file name="images\dark\qtip\close.gif" path="images\dark\qtip" /> <file name="images\dark\qtip\tip-sprite.gif" path="images\dark\qtip" /> <file name="images\dark\tabs\scroller-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-btm-inactive-left-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-btm-inactive-right-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-btm-left-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-btm-right-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-close.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-strip-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-strip-bg.png" path="images\dark\tabs" /> <file name="images\dark\tabs\tab-strip-btm-bg.gif" path="images\dark\tabs" /> <file name="images\dark\tabs\tabs-sprite.gif" path="images\dark\tabs" /> <file name="images\dark\toolbar\bg.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\btn-arrow-light.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\btn-arrow.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\btn-over-bg.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\gray-bg.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\tb-bg.gif" path="images\dark\toolbar" /> <file name="images\dark\toolbar\tb-btn-sprite.gif" path="images\dark\toolbar" /> <file name="images\dark\window\icon-error.gif" path="images\dark\window" /> <file name="images\dark\window\icon-info.gif" path="images\dark\window" /> <file name="images\dark\window\icon-question.gif" path="images\dark\window" /> <file name="images\dark\window\icon-warning.gif" path="images\dark\window" /> <file name="images\dark\window\left-corners.png" path="images\dark\window" /> <file name="images\dark\window\left-corners.pspimage" path="images\dark\window" /> <file name="images\dark\window\left-right.png" path="images\dark\window" /> <file name="images\dark\window\right-corners.png" path="images\dark\window" /> <file name="images\dark\window\top-bottom.png" path="images\dark\window" /> <file name="images\dark\gradient-bg.gif" path="images\dark" /> <file name="images\dark\s.gif" path="images\dark" /> <file name="images\default\tabs\scroll-left.gif" path="images\default\tabs" /> <file name="images\default\tabs\scroll-right.gif" path="images\default\tabs" /> <file name="css\reset.css" path="css" /> <file name="images\gray\tabs\scroll-left.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\scroll-right.gif" path="images\gray\tabs" /> <file name="images\default\shared\loading-balls.gif" path="images\default\shared" /> <file name="raw-images\shadow.psd" path="raw-images" /> <file name="images\default\tree\arrow-closed-over.gif" path="images\default\tree" /> <file name="images\default\tree\arrow-closed.gif" path="images\default\tree" /> <file name="images\default\tree\arrow-open-over.gif" path="images\default\tree" /> <file name="images\default\tree\arrow-open.gif" path="images\default\tree" /> <file name="images\default\tree\arrows.gif" path="images\default\tree" /> </project>
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/resources.jsb
JavaScript
mit
53,432
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* Grid2 styles */ .x-grid { position:relative; overflow:hidden; background-color:#fff; } .x-grid-scroller { overflow:auto; } .x-grid-viewport, .x-grid-locked{ position:absolute; left:0; top: 0; z-index:2; overflow:hidden; visibility:hidden; } .x-grid-cell-inner, .x-grid-hd-inner{ overflow:hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; } .x-grid-hd-row td, .x-grid-row td{ font:normal 11px arial, tahoma, helvetica, sans-serif; line-height:13px; white-space: nowrap; vertical-align: top; -moz-outline: none; -moz-user-focus: normal; } .x-grid-hd-row td { line-height:14px; } .x-grid-col { border-right: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb; } /* Locked styles */ .x-grid-locked .x-grid-body td { background-color: #FBFDFF; border-right: 1px solid #deecfd; border-bottom: 1px solid #deecfd !important; } .x-grid-locked .x-grid-body td .x-grid-cell-inner { border-top:0 none; } .x-grid-locked .x-grid-row-alt td{ background-color: #F5FAFE; } .x-grid-locked .x-grid-header table{ border-right:1px solid transparent; } .x-grid-locked .x-grid-body table{ border-right:1px solid #c3daf9; } .x-grid-locked .x-grid-body td .x-grid-cell-inner { } .x-grid-row { cursor: default; } .x-grid-row-alt{ background-color:#f1f1f1; } .x-grid-row-over td{ background-color:#d9e8fb; } .x-grid-resize-proxy { width:3px; background-color:#cccccc; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; visibility:hidden; border:0 none; z-index:7; } .x-grid-focus { position:absolute; top:0; -moz-outline:0 none; outline:0 none; -moz-user-select: normal; -khtml-user-select: normal; } /* header styles */ .x-grid-header{ background: #ebeadb url(../images/default/grid/grid-hrow.gif) repeat-x; overflow:hidden; position:relative; cursor:default; width:100%; } .x-grid-hd-row{ height:22px; } .x-grid-hd { padding-right:1px; } .x-grid-hd-over .x-grid-hd-inner { border-bottom: 1px solid #c3daf9; } .x-grid-hd-over .x-grid-hd-text { background: #fafafa url(../images/default/grid/grid-hrow.gif) repeat-x 0 1px; padding-bottom:1px; border-bottom: 1px solid #b3cae9; } .x-grid-sort-icon{ background-repeat: no-repeat; display: none; height: 4px; width: 13px; margin-left:3px; vertical-align: middle; } .x-grid-header .sort-asc .x-grid-sort-icon { background-image: url(../images/default/grid/sort_asc.gif); display: inline; } .x-grid-header .sort-desc .x-grid-sort-icon { background-image: url(../images/default/grid/sort_desc.gif); display: inline; } /* Body Styles */ .x-grid-body { overflow:hidden; position:relative; width:100%; zoom:1; } .x-grid-cell-text,.x-grid-hd-text { display: block; padding: 3px 5px 3px 5px; -moz-user-select: none; -khtml-user-select: none; color:black; } .x-grid-hd-text { padding-top:4px; } .x-grid-split { background-image: url(../images/default/grid/grid-split.gif); background-position: center; background-repeat: no-repeat; cursor: e-resize; cursor: col-resize; display: block; font-size: 1px; height: 16px; overflow: hidden; position: absolute; top: 2px; width: 6px; z-index: 3; } .x-grid-hd-text { color:#15428b; } /* Column Reorder DD */ .x-dd-drag-proxy .x-grid-hd-inner{ background: #ebeadb url(../images/default/grid/grid-hrow.gif) repeat-x; height:22px; width:120px; } .col-move-top, .col-move-bottom{ width:9px; height:9px; position:absolute; top:0; line-height:1px; font-size:1px; overflow:hidden; visibility:hidden; z-index:20000; } .col-move-top{ background:transparent url(../images/default/grid/col-move-top.gif) no-repeat left top; } .col-move-bottom{ background:transparent url(../images/default/grid/col-move-bottom.gif) no-repeat left top; } /* Selection Styles */ .x-grid-row-selected td, .x-grid-locked .x-grid-row-selected td{ background-color: #316ac5 !important; color: white; } .x-grid-row-selected span, .x-grid-row-selected b, .x-grid-row-selected div, .x-grid-row-selected strong, .x-grid-row-selected i{ color: white !important; } .x-grid-row-selected .x-grid-cell-text{ color: white; } .x-grid-cell-selected{ background-color: #316ac5 !important; color: white; } .x-grid-cell-selected span{ color: white !important; } .x-grid-cell-selected .x-grid-cell-text{ color: white; } .x-grid-locked td.x-grid-row-marker, .x-grid-locked .x-grid-row-selected td.x-grid-row-marker{ background: #ebeadb url(../images/default/grid/grid-hrow.gif) repeat-x 0 bottom !important; vertical-align:middle !important; color:black; padding:0; border-top:1px solid white; border-bottom:none !important; border-right:1px solid #6fa0df !important; text-align:center; } .x-grid-locked td.x-grid-row-marker div, .x-grid-locked .x-grid-row-selected td.x-grid-row-marker div{ padding:0 4px; color:#15428b !important; text-align:center; } /* dirty cells */ .x-grid-dirty-cell { background: transparent url(../images/default/grid/dirty.gif) no-repeat 0 0; } /* Grid Toolbars */ .x-grid-topbar, .x-grid-bottombar{ font:normal 11px arial, tahoma, helvetica, sans-serif; overflow:hidden; display:none; zoom:1; position:relative; } .x-grid-topbar .x-toolbar{ border-right:0 none; } .x-grid-bottombar .x-toolbar{ border-right:0 none; border-bottom:0 none; border-top:1px solid #a9bfd3; } /* Props Grid Styles */ .x-props-grid .x-grid-cell-selected .x-grid-cell-text{ background-color: #316ac5 !important; } .x-props-grid .x-grid-col-value .x-grid-cell-text{ background-color: white; } .x-props-grid .x-grid-col-name{ background-color: #c3daf9; } .x-props-grid .x-grid-col-name .x-grid-cell-text{ background-color: white; margin-left:10px; } .x-props-grid .x-grid-split-value { visibility:hidden; } /* header menu */ .xg-hmenu-sort-asc .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-asc.gif); } .xg-hmenu-sort-desc .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-desc.gif); } .xg-hmenu-lock .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-lock.gif); } .xg-hmenu-unlock .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-unlock.gif); } /* dd */ .x-dd-drag-ghost .x-grid-dd-wrap { padding:1px 3px 3px 1px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/legacy/grid.css
CSS
mit
6,729
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-dlg-proxy { background-image: url(../images/default/gradient-bg.gif); background-color:#c3daf9; border:1px solid #6593cf; z-index:10001; overflow:hidden; position:absolute; left:0;top:0; } .x-dlg-shadow{ background:#aaaaaa; position:absolute; left:0;top:0; } .x-dlg-focus{ -moz-outline:0 none; outline:0 none; width:0; height:0; overflow:hidden; position:absolute; top:0; left:0; } .x-dlg-mask{ z-index:10000; display:none; position:absolute; top:0; left:0; -moz-opacity: 0.5; opacity:.50; filter: alpha(opacity=50); background-color:#CCC; } body.x-body-masked select { visibility:hidden; } body.x-body-masked .x-dlg select { visibility:visible; } .x-dlg{ z-index:10001; overflow:hidden; position:absolute; left:300;top:0; } .x-dlg .x-dlg-hd { background: url(../images/default/basic-dialog/hd-sprite.gif) repeat-x 0 -82px; background-color:navy; color:#FFF; font:bold 12px "sans serif", tahoma, verdana, helvetica; overflow:hidden; padding:5px; white-space: nowrap; } .x-dlg .x-dlg-hd-left { background: url(../images/default/basic-dialog/hd-sprite.gif) no-repeat 0 -41px; padding-left:3px; margin:0; } .x-dlg .x-dlg-hd-right { background: url(../images/default/basic-dialog/hd-sprite.gif) no-repeat right 0; padding-right:3px; } .x-dlg .x-dlg-dlg-body{ background:url(../images/default/layout/gradient-bg.gif); border:1px solid #6593cf; border-top:0 none; padding:10px; position:absolute; top:24px;left:0; z-index:1; overflow:hidden; } .x-dlg-collapsed .x-resizable-handle{ display:none; } .x-dlg .x-dlg-bd{ overflow:hidden; } .x-dlg .x-dlg-ft{ overflow:hidden; padding:5px; padding-bottom:0; } .x-dlg .x-tabs-body{ background:white; overflow:auto; } .x-dlg .x-tabs-top .x-tabs-body{ border:1px solid #6593cf; border-top:0 none; } .x-dlg .x-tabs-bottom .x-tabs-body{ border:1px solid #6593cf; border-bottom:0 none; } .x-dlg .x-layout-container .x-tabs-body{ border:0 none; } .x-dlg .inner-tab{ margin:5px; } .x-dlg .x-dlg-ft .x-btn{ margin-right:5px; float:right; clear:none; } .x-dlg .x-dlg-ft .x-dlg-btns td { border:0; padding:0; } .x-dlg .x-dlg-ft .x-dlg-btns-right table{ float:right; clear:none; } .x-dlg .x-dlg-ft .x-dlg-btns-left table{ float:left; clear:none; } .x-dlg .x-dlg-ft .x-dlg-btns-center{ text-align:center; /*ie*/ } .x-dlg .x-dlg-ft .x-dlg-btns-center table{ margin:0 auto; /*everyone else*/ } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-focus .x-btn-left{ background-position:0 -147px; } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-focus .x-btn-right{ background-position:0 -168px; } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-focus .x-btn-center{ background-position:0 -189px; } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-click .x-btn-center{ background-position:0 -126px; } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-click .x-btn-right{ background-position:0 -84px; } .x-dlg .x-dlg-ft .x-dlg-btns .x-btn-click .x-btn-left{ background-position:0 -63px; } .x-dlg-draggable .x-dlg-hd{ cursor:move; } .x-dlg-closable .x-dlg-hd{ padding-right:22px; } .x-dlg-toolbox { position:absolute; top:4px; right:4px; z-index:6; width:40px; cursor:default; height:15px; background:transparent; } .x-dlg .x-dlg-close, .x-dlg .x-dlg-collapse { float:right; height:15px; width:15px; margin:0; margin-left:2px; padding:0; line-height:1px; font-size:1px; background-repeat:no-repeat; cursor:pointer; visibility:inherit; } .x-dlg .x-dlg-close { background-image:url(../images/default/basic-dialog/close.gif); } .x-dlg .x-dlg-collapse { background-image:url(../images/default/basic-dialog/collapse.gif); } .x-dlg-collapsed .x-dlg-collapse { background-image:url(../images/default/basic-dialog/expand.gif); } .x-dlg .x-dlg-close-over, .x-dlg .x-dlg-collapse-over { } .x-dlg div.x-resizable-handle-east{ background-image:url(../images/default/basic-dialog/e-handle.gif); border:0; background-position:right; margin-right:0; } .x-dlg div.x-resizable-handle-south{ background-image:url(../images/default/sizer/s-handle-dark.gif); border:0; height:6px; } .x-dlg div.x-resizable-handle-west{ background-image:url(../images/default/basic-dialog/e-handle.gif); border:0; background-position:1px; } .x-dlg div.x-resizable-handle-north{ background-image:url(../images/default/s.gif); border:0; } .x-dlg div.x-resizable-handle-northeast, .xtheme-gray .x-dlg div.x-resizable-handle-northeast{ background-image:url(../images/default/s.gif); border:0; } .x-dlg div.x-resizable-handle-northwest, .xtheme-gray .x-dlg div.x-resizable-handle-northwest{ background-image:url(../images/default/s.gif); border:0; } .x-dlg div.x-resizable-handle-southeast{ background-image:url(../images/default/basic-dialog/se-handle.gif); background-position: bottom right; width:8px; height:8px; border:0; } .x-dlg div.x-resizable-handle-southwest{ background-image:url(../images/default/sizer/sw-handle-dark.gif); background-position: top right; margin-left:1px; margin-bottom:1px; border:0; } #x-msg-box .x-dlg-ft .x-btn{ float:none; clear:none; margin:0 3px; } #x-msg-box .x-dlg-bd { padding:5px; overflow:hidden !important; font:normal 13px verdana,tahoma,sans-serif; } #x-msg-box .ext-mb-input { margin-top:4px; width:95%; } #x-msg-box .ext-mb-textarea { margin-top:4px; font:normal 13px verdana,tahoma,sans-serif; } #x-msg-box .ext-mb-progress-wrap { margin-top:4px; border:1px solid #6593cf; } #x-msg-box .ext-mb-progress { height:18px; background: #e0e8f3 url(../images/default/qtip/bg.gif) repeat-x; } #x-msg-box .ext-mb-progress-bar { height:18px; overflow:hidden; width:0; background:#8BB8F3; border-top:1px solid #B2D0F7; border-bottom:1px solid #65A1EF; border-right:1px solid #65A1EF; } #x-msg-box .x-msg-box-wait { background: transparent url(../images/default/grid/loading.gif) no-repeat left; display:block; width:300px; padding-left:18px; line-height:18px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/legacy/basic-dialog.css
CSS
mit
6,367
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-window { zoom:1; } .x-window .x-resizable-handle { opacity:0; -moz-opacity:0; filter:alpha(opacity=0); } .x-window-proxy { background:#C7DFFC; border:1px solid #99bbe8; z-index:12000; overflow:hidden; position:absolute; left:0;top:0; display:none; opacity:.5; -moz-opacity:.5; filter:alpha(opacity=50); } .x-window-header { overflow:hidden; zoom:1; } .x-window-bwrap { z-index:1; position:relative; zoom:1; } .x-window-tl .x-window-header { color:#15428b; font:bold 11px tahoma,arial,verdana,sans-serif; padding:5px 0 4px 0; } .x-window-header-text { cursor:pointer; } .x-window-tc { background: transparent url(../images/default/window/top-bottom.png) repeat-x 0 0; overflow:hidden; zoom:1; } .x-window-tl { background: transparent url(../images/default/window/left-corners.png) no-repeat 0 0; padding-left:6px; zoom:1; z-index:1; position:relative; } .x-window-tr { background: transparent url(../images/default/window/right-corners.png) no-repeat right 0; padding-right:6px; } .x-window-bc { background: transparent url(../images/default/window/top-bottom.png) repeat-x 0 bottom; zoom:1; } .x-window-bc .x-window-footer { padding-bottom:6px; zoom:1; font-size:0; line-height:0; } .x-window-bl { background: transparent url(../images/default/window/left-corners.png) no-repeat 0 bottom; padding-left:6px; zoom:1; } .x-window-br { background: transparent url(../images/default/window/right-corners.png) no-repeat right bottom; padding-right:6px; zoom:1; } .x-window-mc { border:1px solid #99bbe8; padding:0; margin:0; font: normal 11px tahoma,arial,helvetica,sans-serif; background:#dfe8f6; } .x-window-ml { background: transparent url(../images/default/window/left-right.png) repeat-y 0 0; padding-left:6px; zoom:1; } .x-window-mr { background: transparent url(../images/default/window/left-right.png) repeat-y right 0; padding-right:6px; zoom:1; } .x-panel-nofooter .x-window-bc { height:6px; } .x-window-body { overflow:hidden; } .x-window-bwrap { overflow:hidden; } .x-window-maximized .x-window-bl, .x-window-maximized .x-window-br, .x-window-maximized .x-window-ml, .x-window-maximized .x-window-mr, .x-window-maximized .x-window-tl, .x-window-maximized .x-window-tr { padding:0; } .x-window-maximized .x-window-footer { padding-bottom:0; } .x-window-maximized .x-window-tc { padding-left:3px; padding-right:3px; background-color:white; } .x-window-maximized .x-window-mc { border-left:0 none; border-right:0 none; } .x-window-tbar .x-toolbar, .x-window-bbar .x-toolbar { border-left:0 none; border-right: 0 none; } .x-window-bbar .x-toolbar { border-top:1px solid #99bbe8; border-bottom:0 none; } .x-window-draggable, .x-window-draggable .x-window-header-text { cursor:move; } .x-window-maximized .x-window-draggable, .x-window-maximized .x-window-draggable .x-window-header-text { cursor:default; } .x-window-body { background:transparent; } .x-panel-ghost .x-window-tl { border-bottom:1px solid #99bbe8; } .x-panel-collapsed .x-window-tl { border-bottom:1px solid #84a0c4; } .x-window-maximized-ct { overflow:hidden; } .x-window-maximized .x-resizable-handle { display:none; } .x-window-sizing-ghost ul { border:0 none !important; } .x-dlg-focus{ -moz-outline:0 none; outline:0 none; width:0; height:0; overflow:hidden; position:absolute; top:0; left:0; } .x-dlg-mask{ z-index:10000; display:none; position:absolute; top:0; left:0; -moz-opacity: 0.5; opacity:.50; filter: alpha(opacity=50); background-color:#CCC; } body.ext-ie6.x-body-masked select { visibility:hidden; } body.ext-ie6.x-body-masked .x-window select { visibility:visible; } .x-window-plain .x-window-mc { background: #CAD9EC; border-right:1px solid #DFE8F6; border-bottom:1px solid #DFE8F6; border-top:1px solid #a3bae9; border-left:1px solid #a3bae9; } .x-window-plain .x-window-body { border-left:1px solid #DFE8F6; border-top:1px solid #DFE8F6; border-bottom:1px solid #a3bae9; border-right:1px solid #a3bae9; background:transparent !important; } body.x-body-masked .x-window-plain .x-window-mc { background: #C7D6E9; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/window.css
CSS
mit
4,696
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* all fields */ .x-form-field{ margin: 0 0 0 0; font:normal 12px tahoma, arial, helvetica, sans-serif; } /* ---- text fields ---- */ .x-form-text, textarea.x-form-field{ padding:1px 3px; background:#fff url(../images/default/form/text-bg.gif) repeat-x 0 0; border:1px solid #B5B8C8; } textarea.x-form-field { padding:2px 3px; } .x-form-text { height:22px; line-height:18px; vertical-align:middle; } .ext-ie .x-form-text { margin:-1px 0; /* ie bogus margin bug */ height:22px; /* ie quirks */ line-height:18px; } .ext-ie textarea.x-form-field { margin:-1px 0; /* ie bogus margin bug */ } .ext-strict .x-form-text { height:18px; } .ext-safari .x-form-text { height:20px; /* safari always same size */ padding:0 3px; /* remove extra top/bottom padding */ } .ext-safari.ext-mac textarea.x-form-field { margin-bottom:-2px; /* another bogus margin bug, safari/mac only */ } .ext-gecko .x-form-text { padding-top:2px; /* FF won't center the text vertically */ padding-bottom:0; } textarea { resize: none; /* Disable browser resizable textarea */ } /* select boxes */ .x-form-select-one { height:20px; line-height:18px; vertical-align:middle; background-color:#fff; /* opera */ border: 1px solid #B5B8C8; } /* multi select boxes */ /* --- TODO --- */ /* checkboxes */ /* --- TODO --- */ /* radios */ /* --- TODO --- */ /* wrapped fields and triggers */ .x-form-field-wrap { position:relative; zoom:1; white-space: nowrap; } .x-editor .x-form-check-wrap { background:#fff; } .x-form-field-wrap .x-form-trigger{ width:17px; height:21px; border:0; background:transparent url(../images/default/form/trigger.gif) no-repeat 0 0; cursor:pointer; border-bottom: 1px solid #B5B8C8; position:absolute; top:0; } .ext-safari .x-form-field-wrap .x-form-trigger{ height:21px; /* safari doesn't allow height adjustments to the fields, so adjust trigger */ } .x-form-field-wrap .x-form-date-trigger{ background-image: url(../images/default/form/date-trigger.gif); cursor:pointer; } .x-form-field-wrap .x-form-clear-trigger{ background-image: url(../images/default/form/clear-trigger.gif); cursor:pointer; } .x-form-field-wrap .x-form-search-trigger{ background-image: url(../images/default/form/search-trigger.gif); cursor:pointer; } .ext-safari .x-form-field-wrap .x-form-trigger{ right:0; } .x-form-field-wrap .x-form-twin-triggers{ } .x-form-field-wrap .x-form-twin-triggers .x-form-trigger{ position:static; top:auto; vertical-align:top; } .x-form-field-wrap .x-form-trigger-over{ background-position:-17px 0; } .x-form-field-wrap .x-form-trigger-click{ background-position:-34px 0; } .x-trigger-wrap-focus .x-form-trigger{ background-position:-51px 0; } .x-trigger-wrap-focus .x-form-trigger-over{ background-position:-68px 0; } .x-trigger-wrap-focus .x-form-trigger-click{ background-position:-85px 0; } .x-trigger-wrap-focus .x-form-trigger{ border-bottom: 1px solid #7eadd9; } .x-item-disabled .x-form-trigger-over{ background-position:0 0 !important; border-bottom: 1px solid #B5B8C8; } .x-item-disabled .x-form-trigger-click{ background-position:0 0 !important; border-bottom: 1px solid #B5B8C8; } /* field focus style */ .x-form-focus, textarea.x-form-focus{ border: 1px solid #7eadd9; } /* invalid fields */ .x-form-invalid, textarea.x-form-invalid{ background:#fff url(../images/default/grid/invalid_line.gif) repeat-x bottom; border: 1px solid #dd7870; } .ext-safari .x-form-invalid{ background-color:#ffeeee; border: 1px solid #ff7870; } /* editors */ .x-editor { visibility:hidden; padding:0; margin:0; } .x-form-check-wrap { line-height:18px; } .ext-ie .x-form-check-wrap input { width:15px; height:15px; } .x-editor .x-form-check-wrap { padding:3px; } .x-editor .x-form-checkbox { height:13px; } /* If you override the default field font above, you would need to change this font as well */ .x-form-grow-sizer { font:normal 12px tahoma, arial, helvetica, sans-serif; left: -10000px; padding: 8px 3px; position: absolute; visibility:hidden; top: -10000px; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; zoom:1; } .x-form-grow-sizer p { margin:0 !important; border:0 none !important; padding:0 !important; } /* Form Items CSS */ .x-form-item { font:normal 12px tahoma, arial, helvetica, sans-serif; display:block; margin-bottom:4px; } .x-form-item label { display:block; float:left; width:100px; padding:3px; padding-left:0; clear:left; z-index:2; position:relative; } .x-form-element { padding-left:105px; position:relative; } .x-form-invalid-msg { color:#ee0000; padding:2px; padding-left:18px; font:normal 11px tahoma, arial, helvetica, sans-serif; background: transparent url(../images/default/shared/warning.gif) no-repeat 0 2px; line-height:16px; width:200px; } .x-form-label-right label { text-align:right; } .x-form-label-top .x-form-item label { width:auto; float:none; clear:none; display:inline; margin-bottom:4px; position:static; } .x-form-label-top .x-form-element { padding-left:0; padding-top:4px; } .x-form-label-top .x-form-item { padding-bottom:4px; } .x-form-empty-field { color:gray; } /* Editor small font for grid, toolbar and tree */ .x-small-editor .x-form-field { font:normal 11px arial, tahoma, helvetica, sans-serif; } .x-small-editor .x-form-text { height:20px; line-height:16px; vertical-align:middle; } .ext-ie .x-small-editor .x-form-text { margin-top:-1px !important; /* ie bogus margin bug */ margin-bottom:-1px !important; height:20px !important; /* ie quirks */ line-height:16px !important; } .ext-strict .x-small-editor .x-form-text { height:16px !important; } .ext-safari .x-small-editor .x-form-field { /* safari text field will not size so needs bigger font */ font:normal 12px arial, tahoma, helvetica, sans-serif; } .ext-ie .x-small-editor .x-form-text { height:20px; line-height:16px; } .ext-border-box .x-small-editor .x-form-text { height:20px; } .x-small-editor .x-form-select-one { height:20px; line-height:16px; vertical-align:middle; } .x-small-editor .x-form-num-field { text-align:right; } .x-small-editor .x-form-field-wrap .x-form-trigger{ height:19px; } .x-form-clear { clear:both; height:0; overflow:hidden; line-height:0; font-size:0; } .x-form-clear-left { clear:left; height:0; overflow:hidden; line-height:0; font-size:0; } .x-form-cb-label { width:'auto' !important; float:none !important; clear:none !important; display:inline !important; margin-left:4px; } .x-form-column { float:left; padding:0; margin:0; width:48%; overflow:hidden; zoom:1; } /* buttons */ .x-form .x-form-btns-ct .x-btn{ float:right; clear:none; } .x-form .x-form-btns-ct .x-form-btns td { border:0; padding:0; } .x-form .x-form-btns-ct .x-form-btns-right table{ float:right; clear:none; } .x-form .x-form-btns-ct .x-form-btns-left table{ float:left; clear:none; } .x-form .x-form-btns-ct .x-form-btns-center{ text-align:center; /*ie*/ } .x-form .x-form-btns-ct .x-form-btns-center table{ margin:0 auto; /*everyone else*/ } .x-form .x-form-btns-ct table td.x-form-btn-td{ padding:3px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-left{ background-position:0 -147px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-right{ background-position:0 -168px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-center{ background-position:0 -189px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-center{ background-position:0 -126px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-right{ background-position:0 -84px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-left{ background-position:0 -63px; } .x-form-invalid-icon { width:16px; height:18px; visibility:hidden; position:absolute; left:0; top:0; display:block; background:transparent url(../images/default/form/exclamation.gif) no-repeat 0 2px; } /* fieldsets */ .x-fieldset { border:1px solid #B5B8C8; padding:10px; margin-bottom:10px; } .x-fieldset legend { font:bold 11px tahoma, arial, helvetica, sans-serif; color:#15428b; } .ext-ie .x-fieldset legend { margin-bottom:10px; } .ext-ie .x-fieldset { padding-top: 0; padding-bottom:10px; } .x-fieldset legend .x-tool-toggle { margin-right:3px; margin-left:0; float:left !important; } .x-fieldset legend input { margin-right:3px; float:left !important; height:13px; width:13px; } fieldset.x-panel-collapsed { padding-bottom:0 !important; border-width: 1px 0 0 0 !important; } fieldset.x-panel-collapsed .x-fieldset-bwrap { visibility:hidden; position:absolute; left:-1000px; top:-1000px; } .ext-ie .x-fieldset-bwrap { zoom:1; } .ext-ie td .x-form-text { position:relative; top:-1px; } .x-fieldset-noborder { border:0px none transparent; } .x-fieldset-noborder legend { margin-left:-3px; } /* IE legend positioing bug */ .ext-ie .x-fieldset-noborder legend { position: relative; margin-bottom:23px; } .ext-ie .x-fieldset-noborder legend span { position: absolute; left:-5px; } .ext-gecko .x-window-body .x-form-item { -moz-outline: none; overflow: auto; } .ext-gecko .x-form-item { -moz-outline: none; } .x-hide-label label.x-form-item-label { display:none; } .x-hide-label .x-form-element { padding-left: 0 !important; } .x-fieldset { overflow:hidden; } .x-fieldset-bwrap { overflow:hidden; zoom:1; } .x-fieldset-body { overflow:hidden; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/form.css
CSS
mit
10,617
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .ext-el-mask { z-index: 20000; position: absolute; top:0; left:0; -moz-opacity: 0.5; opacity: .50; filter: alpha(opacity=50); background-color: #CCC; width: 100%; height: 100%; zoom: 1; } .ext-el-mask-msg { z-index: 20001; position: absolute; top: 0; left: 0; border:1px solid #6593cf; background: #c3daf9 url(../images/default/box/tb-blue.gif) repeat-x 0 -16px; padding:2px; } .ext-el-mask-msg div { padding:5px 10px 5px 10px; background: #eee; border:1px solid #a3bad9; color:#222; font:normal 11px tahoma, arial, helvetica, sans-serif; cursor:wait; } .ext-shim { position:absolute; visibility:hidden; left:0; top:0; overflow:hidden; } .ext-ie .ext-shim { filter: alpha(opacity=0); } .ext-ie6 .ext-shim { margin-left: 5px; margin-top: 3px; } .x-mask-loading div { padding:5px 10px 5px 25px; background: #fbfbfb url( '../images/default/grid/loading.gif' ) no-repeat 5px 5px; line-height: 16px; } /* class for hiding elements without using display:none */ .x-hidden, .x-hide-offsets { position:absolute; left:-10000px; top:-10000px; visibility:hidden; } .x-hide-display { display:none !important; } .x-hide-visibility { visibility:hidden !important; } .x-masked { overflow: hidden !important; } .x-masked select, .x-masked object, .x-masked embed { visibility: hidden; } .x-layer { visibility: hidden; } .x-unselectable, .x-unselectable * { -moz-user-select: none; -khtml-user-select: none; } .x-repaint { zoom: 1; background-color: transparent; -moz-outline: none; } .x-item-disabled { color: gray; cursor: default; opacity: .6; -moz-opacity: .6; filter: alpha(opacity=60); } .x-item-disabled * { color: gray !important; cursor: default !important; } .x-splitbar-proxy { position: absolute; visibility: hidden; z-index: 20001; background: #aaa; zoom: 1; line-height: 1px; font-size: 1px; overflow: hidden; } .x-splitbar-h, .x-splitbar-proxy-h { cursor: e-resize; cursor: col-resize; } .x-splitbar-v, .x-splitbar-proxy-v { cursor: s-resize; cursor: row-resize; } .x-color-palette { width: 150px; height: 92px; cursor: pointer; } .x-color-palette a { border: 1px solid #fff; float: left; padding: 2px; text-decoration: none; -moz-outline: 0 none; outline: 0 none; cursor: pointer; } .x-color-palette a:hover, .x-color-palette a.x-color-palette-sel { border: 1px solid #8BB8F3; background: #deecfd; } .x-color-palette em { display: block; border: 1px solid #ACA899; } .x-color-palette em span { cursor: pointer; display: block; height: 10px; line-height: 10px; width: 10px; } .x-ie-shadow { display: none; position: absolute; overflow: hidden; left:0; top:0; background:#777; zoom:1; } .x-shadow { display: none; position: absolute; overflow: hidden; left:0; top:0; } .x-shadow * { overflow: hidden; } .x-shadow * { padding: 0; border: 0; margin: 0; clear: none; zoom: 1; } /* top bottom */ .x-shadow .xstc, .x-shadow .xsbc { height: 6px; float: left; } /* corners */ .x-shadow .xstl, .x-shadow .xstr, .x-shadow .xsbl, .x-shadow .xsbr { width: 6px; height: 6px; float: left; } /* sides */ .x-shadow .xsc { width: 100%; } .x-shadow .xsml, .x-shadow .xsmr { width: 6px; float: left; height: 100%; } .x-shadow .xsmc { float: left; height: 100%; background: transparent url( ../images/default/shadow-c.png ); } .x-shadow .xst, .x-shadow .xsb { height: 6px; overflow: hidden; width: 100%; } .x-shadow .xsml { background: transparent url( ../images/default/shadow-lr.png ) repeat-y 0 0; } .x-shadow .xsmr { background: transparent url( ../images/default/shadow-lr.png ) repeat-y -6px 0; } .x-shadow .xstl { background: transparent url( ../images/default/shadow.png ) no-repeat 0 0; } .x-shadow .xstc { background: transparent url( ../images/default/shadow.png ) repeat-x 0 -30px; } .x-shadow .xstr { background: transparent url( ../images/default/shadow.png ) repeat-x 0 -18px; } .x-shadow .xsbl { background: transparent url( ../images/default/shadow.png ) no-repeat 0 -12px; } .x-shadow .xsbc { background: transparent url( ../images/default/shadow.png ) repeat-x 0 -36px; } .x-shadow .xsbr { background: transparent url( ../images/default/shadow.png ) repeat-x 0 -6px; } .loading-indicator { font-size: 11px; background-image: url(../images/default/grid/loading.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px; line-height: 16px; margin: 3px; } .x-text-resize { position: absolute; left: -1000px; top: -1000px; visibility: hidden; zoom: 1; } .x-drag-overlay { width: 100%; height: 100%; display: none; position: absolute; left: 0; top: 0; background-image:url(../images/default/s.gif); z-index: 20000; } .x-clear { clear:both; height:0; overflow:hidden; line-height:0; font-size:0; } .x-spotlight { z-index: 8999; position: absolute; top:0; left:0; -moz-opacity: 0.5; opacity: .50; filter: alpha(opacity=50); background-color: #CCC; width:0; height:0; zoom: 1; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/core.css
CSS
mit
5,932
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-html-editor-wrap { border:1px solid #a9bfd3; background:white; } .x-html-editor-tb .x-btn-text { background:transparent url(../images/default/editor/tb-sprite.gif) no-repeat; } .x-html-editor-tb .x-edit-bold .x-btn-text { background-position:0 0; } .x-html-editor-tb .x-edit-italic .x-btn-text { background-position:-16px 0; } .x-html-editor-tb .x-edit-underline .x-btn-text { background-position:-32px 0; } .x-html-editor-tb .x-edit-forecolor .x-btn-text { background-position:-160px 0; } .x-html-editor-tb .x-edit-backcolor .x-btn-text { background-position:-176px 0; } .x-html-editor-tb .x-edit-justifyleft .x-btn-text { background-position:-112px 0; } .x-html-editor-tb .x-edit-justifycenter .x-btn-text { background-position:-128px 0; } .x-html-editor-tb .x-edit-justifyright .x-btn-text { background-position:-144px 0; } .x-html-editor-tb .x-edit-insertorderedlist .x-btn-text { background-position:-80px 0; } .x-html-editor-tb .x-edit-insertunorderedlist .x-btn-text { background-position:-96px 0; } .x-html-editor-tb .x-edit-increasefontsize .x-btn-text { background-position:-48px 0; } .x-html-editor-tb .x-edit-decreasefontsize .x-btn-text { background-position:-64px 0; } .x-html-editor-tb .x-edit-sourceedit .x-btn-text { background-position:-192px 0; } .x-html-editor-tb .x-edit-createlink .x-btn-text { background-position:-208px 0; } .x-html-editor-tip .x-tip-bd .x-tip-bd-inner { padding:5px; padding-bottom:1px; } .x-html-editor-tb .x-toolbar { position:static !important; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/editor.css
CSS
mit
1,768
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-window-dlg .x-window-body { border:0 none !important; padding:5px 10px; overflow:hidden !important; } .x-window-dlg .x-window-mc { border:0 none !important; } .x-window-dlg .ext-mb-text, .x-window-dlg .x-window-header-text { font-size:12px; } .x-window-dlg .ext-mb-input { margin-top:4px; width:95%; } .x-window-dlg .ext-mb-textarea { margin-top:4px; font:normal 12px tahoma,arial,helvetica,sans-serif; } .x-window-dlg .x-progress-wrap { margin-top:4px; } .ext-ie .x-window-dlg .x-progress-wrap { margin-top:6px; } .x-window-dlg .x-msg-box-wait { background: transparent url(../images/default/grid/loading.gif) no-repeat left; display:block; width:300px; padding-left:18px; line-height:18px; } .x-window-dlg .ext-mb-icon { float:left; width:47px; height:32px; } .ext-ie .x-window-dlg .ext-mb-icon { width:44px; /* 3px IE margin issue */ } .x-window-dlg .ext-mb-info { background:transparent url(../images/default/window/icon-info.gif) no-repeat top left; } .x-window-dlg .ext-mb-warning { background:transparent url(../images/default/window/icon-warning.gif) no-repeat top left; } .x-window-dlg .ext-mb-question { background:transparent url(../images/default/window/icon-question.gif) no-repeat top left; } .x-window-dlg .ext-mb-error { background:transparent url(../images/default/window/icon-error.gif) no-repeat top left; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/dialog.css
CSS
mit
1,612
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* Creates rounded, raised boxes like on the Ext website - the markup isn't pretty: <div class="x-box-blue"> <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div> <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"> <h3>YOUR TITLE HERE (optional)</h3> <div>YOUR CONTENT HERE</div> </div></div></div> <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div> </div> */ .x-box-tl { background: transparent url(../images/default/box/corners.gif) no-repeat 0 0; zoom:1; } .x-box-tc { height: 8px; background: transparent url(../images/default/box/tb.gif) repeat-x 0 0; overflow: hidden; } .x-box-tr { background: transparent url(../images/default/box/corners.gif) no-repeat right -8px; } .x-box-ml { background: transparent url(../images/default/box/l.gif) repeat-y 0; padding-left: 4px; overflow: hidden; zoom:1; } .x-box-mc { background: #eee url(../images/default/box/tb.gif) repeat-x 0 -16px; padding: 4px 10px; font-family: "Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif; color: #393939; font-size: 12px; } .x-box-mc h3 { font-size: 14px; font-weight: bold; margin: 0 0 4px 0; zoom:1; } .x-box-mr { background: transparent url(../images/default/box/r.gif) repeat-y right; padding-right: 4px; overflow: hidden; } .x-box-bl { background: transparent url(../images/default/box/corners.gif) no-repeat 0 -16px; zoom:1; } .x-box-bc { background: transparent url(../images/default/box/tb.gif) repeat-x 0 -8px; height: 8px; overflow: hidden; } .x-box-br { background: transparent url(../images/default/box/corners.gif) no-repeat right -24px; } .x-box-tl, .x-box-bl { padding-left: 8px; overflow: hidden; } .x-box-tr, .x-box-br { padding-right: 8px; overflow: hidden; } .x-box-blue .x-box-bl, .x-box-blue .x-box-br, .x-box-blue .x-box-tl, .x-box-blue .x-box-tr { background-image: url(../images/default/box/corners-blue.gif); } .x-box-blue .x-box-bc, .x-box-blue .x-box-mc, .x-box-blue .x-box-tc { background-image: url(../images/default/box/tb-blue.gif); } .x-box-blue .x-box-mc { background-color: #c3daf9; } .x-box-blue .x-box-mc h3 { color: #17385b; } .x-box-blue .x-box-ml { background-image: url(../images/default/box/l-blue.gif); } .x-box-blue .x-box-mr { background-image: url(../images/default/box/r-blue.gif); }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/box.css
CSS
mit
2,673
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-date-picker { border: 1px solid #1b376c; border-top:0 none; background:#fff; position:relative; } .x-date-picker a { -moz-outline:0 none; outline:0 none; } .x-date-inner, .x-date-inner td, .x-date-inner th{ border-collapse:separate; } .x-date-middle,.x-date-left,.x-date-right { background: url(../images/default/shared/hd-sprite.gif) repeat-x 0 -83px; color:#FFF; font:bold 11px "sans serif", tahoma, verdana, helvetica; overflow:hidden; } .x-date-middle .x-btn-left,.x-date-middle .x-btn-center,.x-date-middle .x-btn-right{ background:transparent !important; vertical-align:middle; } .x-date-middle .x-btn .x-btn-text { color:#fff; } .x-date-middle .x-btn-with-menu .x-btn-center em { background:transparent url(../images/default/toolbar/btn-arrow-light.gif) no-repeat right 0; } .x-date-right, .x-date-left { width:18px; } .x-date-right{ text-align:right; } .x-date-middle { padding-top:2px;padding-bottom:2px; } .x-date-right a, .x-date-left a{ display:block; width:16px; height:16px; background-position: center; background-repeat: no-repeat; cursor:pointer; -moz-opacity: 0.6; opacity:.6; filter: alpha(opacity=60); } .x-date-right a:hover, .x-date-left a:hover{ -moz-opacity: 1; opacity:1; filter: alpha(opacity=100); } .x-date-right a { background-image: url(../images/default/shared/right-btn.gif); margin-right:2px; text-decoration:none !important; } .x-date-left a{ background-image: url(../images/default/shared/left-btn.gif); margin-left:2px; text-decoration:none !important; } table.x-date-inner { width:100%; table-layout:fixed; } .x-date-inner th { width:25px; } .x-date-inner th { background: #dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top; text-align:right !important; border-bottom: 1px solid #a3bad9; font:normal 10px arial, helvetica,tahoma,sans-serif; color:#233d6d; cursor:default; padding:0; border-collapse:separate; } .x-date-inner th span { display:block; padding:2px; padding-right:7px; } .x-date-inner td { border: 1px solid #fff; text-align:right; padding:0; } .x-date-inner a { padding:2px 5px; display:block; font:normal 11px arial, helvetica,tahoma,sans-serif; text-decoration:none; color:black; text-align:right; zoom:1; } .x-date-inner .x-date-active{ cursor:pointer; color:black; } .x-date-inner .x-date-selected a{ background: #dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top; border:1px solid #8db2e3; padding:1px 4px; } .x-date-inner .x-date-today a{ border: 1px solid darkred; padding:1px 4px; } .x-date-inner .x-date-selected span{ font-weight:bold; } .x-date-inner .x-date-prevday a,.x-date-inner .x-date-nextday a { color:#aaaaaa; text-decoration:none !important; } .x-date-bottom { padding:4px; border-top: 1px solid #a3bad9; background: #dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top; } .x-date-inner a:hover, .x-date-inner .x-date-disabled a:hover{ text-decoration:none !important; color:black; background: #ddecfe; } .x-date-inner .x-date-disabled a { cursor:default; background:#eeeeee; color:#bbbbbb; } .x-date-mmenu{ background:#eeeeee !important; } .x-date-mmenu .x-menu-item { font-size:10px; padding:1px 24px 1px 4px; white-space: nowrap; color:#000; } .x-date-mmenu .x-menu-item .x-menu-item-icon { width:10px;height:10px;margin-right:5px; background-position:center -4px !important; } .x-date-mp { position:absolute; left:0; top:0; background:white; display:none; } .x-date-mp td { padding:2px; font:normal 11px arial, helvetica,tahoma,sans-serif; } td.x-date-mp-month,td.x-date-mp-year,td.x-date-mp-ybtn { border: 0 none; text-align:center; vertical-align: middle; width:25%; } .x-date-mp-ok { margin-right:3px; } .x-date-mp-btns button { text-decoration:none; text-align:center; text-decoration:none !important; background:#083772; color:white; border:1px solid; border-color: #3366cc #000055 #000055 #3366cc; padding:1px 3px 1px; font:normal 11px arial, helvetica,tahoma,sans-serif; cursor:pointer; } .x-date-mp-btns { background: #dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top; } .x-date-mp-btns td { border-top: 1px solid #c5d2df; text-align:center; } td.x-date-mp-month a,td.x-date-mp-year a { display:block; padding:2px 4px; text-decoration:none; text-align:center; color:#15428b; } td.x-date-mp-month a:hover,td.x-date-mp-year a:hover { color:#15428b; text-decoration:none; cursor:pointer; background: #ddecfe; } td.x-date-mp-sel a { padding:1px 3px; background: #dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top; border:1px solid #8db2e3; } .x-date-mp-ybtn a { overflow:hidden; width:15px; height:15px; cursor:pointer; background:transparent url(../images/default/panel/tool-sprites.gif) no-repeat; display:block; margin:0 auto; } .x-date-mp-ybtn a.x-date-mp-next { background-position:0 -120px; } .x-date-mp-ybtn a.x-date-mp-next:hover { background-position:-15px -120px; } .x-date-mp-ybtn a.x-date-mp-prev { background-position:0 -105px; } .x-date-mp-ybtn a.x-date-mp-prev:hover { background-position:-15px -105px; } .x-date-mp-ybtn { text-align:center; } td.x-date-mp-sep { border-right:1px solid #c5d2df; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/date-picker.css
CSS
mit
5,811
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-border-layout-ct { background:#dfe8f6; } .x-border-panel { position:absolute; left:0; top:0; } .x-tool-collapse-south { background-position:0 -195px; } .x-tool-collapse-south-over { background-position:-15px -195px; } .x-tool-collapse-north { background-position:0 -210px; } .x-tool-collapse-north-over { background-position:-15px -210px; } .x-tool-collapse-west { background-position:0 -180px; } .x-tool-collapse-west-over { background-position:-15px -180px; } .x-tool-collapse-east { background-position:0 -165px; } .x-tool-collapse-east-over { background-position:-15px -165px; } .x-tool-expand-south { background-position:0 -210px; } .x-tool-expand-south-over { background-position:-15px -210px; } .x-tool-expand-north { background-position:0 -195px; } .x-tool-expand-north-over { background-position:-15px -195px; } .x-tool-expand-west { background-position:0 -165px; } .x-tool-expand-west-over { background-position:-15px -165px; } .x-tool-expand-east { background-position:0 -180px; } .x-tool-expand-east-over { background-position:-15px -180px; } .x-tool-expand-north, .x-tool-expand-south { float:right; margin:3px; } .x-tool-expand-east, .x-tool-expand-west { float:none; margin:3px auto; } .x-accordion-hd .x-tool-toggle { background-position:0 -255px; } .x-accordion-hd .x-tool-toggle-over { background-position:-15px -255px; } .x-panel-collapsed .x-accordion-hd .x-tool-toggle { background-position:0 -240px; } .x-panel-collapsed .x-accordion-hd .x-tool-toggle-over { background-position:-15px -240px; } .x-accordion-hd { color:#222; padding-top:4px; padding-bottom:3px; border-top:0 none; font-weight:normal; background: transparent url(../images/default/panel/light-hd.gif) repeat-x 0 -9px; } .x-layout-collapsed{ position:absolute; left:-10000px; top:-10000px; visibility:hidden; background-color:#d2e0f2; width:20px; height:20px; overflow:hidden; border:1px solid #98c0f4; z-index:20; } .ext-border-box .x-layout-collapsed{ width:22px; height:22px; } .x-layout-collapsed-over{ cursor:pointer; background-color:#d9e8fb; } .x-layout-collapsed-west .x-layout-collapsed-tools, .x-layout-collapsed-east .x-layout-collapsed-tools{ position:absolute; top:0; left:0; width:20px; height:20px; } .x-layout-split{ position:absolute; height:5px; width:5px; line-height:1px; font-size:1px; z-index:3; background-color:transparent; } .x-layout-split-h{ background-image:url(../images/default/s.gif); background-position: left; } .x-layout-split-v{ background-image:url(../images/default/s.gif); background-position: top; } .x-column-layout-ct { overflow:hidden; /*padding:3px 3px 3px 3px;*/ zoom:1; } .x-column { float:left; padding:0; margin:0; overflow:hidden; zoom:1; /*margin:3px;*/ } /* mini mode */ .x-layout-mini { position:absolute; top:0; left:0; display:block; width:5px; height:35px; cursor:pointer; opacity:.5; -moz-opacity:.5; filter:alpha(opacity=50); } .x-layout-mini-over, .x-layout-collapsed-over .x-layout-mini{ opacity:1; -moz-opacity:1; filter:none; } .x-layout-split-west .x-layout-mini { top:48%; background-image:url(../images/default/layout/mini-left.gif); } .x-layout-split-east .x-layout-mini { top:48%; background-image:url(../images/default/layout/mini-right.gif); } .x-layout-split-north .x-layout-mini { left:48%; height:5px; width:35px; background-image:url(../images/default/layout/mini-top.gif); } .x-layout-split-south .x-layout-mini { left:48%; height:5px; width:35px; background-image:url(../images/default/layout/mini-bottom.gif); } .x-layout-cmini-west .x-layout-mini { top:48%; background-image:url(../images/default/layout/mini-right.gif); } .x-layout-cmini-east .x-layout-mini { top:48%; background-image:url(../images/default/layout/mini-left.gif); } .x-layout-cmini-north .x-layout-mini { left:48%; height:5px; width:35px; background-image:url(../images/default/layout/mini-bottom.gif); } .x-layout-cmini-south .x-layout-mini { left:48%; height:5px; width:35px; background-image:url(../images/default/layout/mini-top.gif); } .x-layout-cmini-west, .x-layout-cmini-east { border:0 none; width:5px !important; padding:0; background:transparent; } .x-layout-cmini-north, .x-layout-cmini-south { border:0 none; height:5px !important; padding:0; background:transparent; } .x-viewport, .x-viewport body { margin: 0; padding: 0; border: 0 none; overflow: hidden; height: 100%; } .x-abs-layout-item { position:absolute; left:0; top:0; } .ext-ie input.x-abs-layout-item, .ext-ie textarea.x-abs-layout-item { margin:0; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/layout.css
CSS
mit
5,369
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-panel { border-style: solid; border-color: #99bbe8; border-width:0; } .x-panel-header { overflow:hidden; zoom:1; color:#15428b; font:bold 11px tahoma,arial,verdana,sans-serif; padding:5px 3px 4px 5px; border:1px solid #99bbe8; line-height: 15px; background: transparent url(../images/default/panel/white-top-bottom.gif) repeat-x 0 -1px; } .x-panel-body { border:1px solid #99bbe8; border-top:0 none; overflow:hidden; background:white; position: relative; /* added for item scroll positioning */ } .x-panel-bbar .x-toolbar { border:1px solid #99bbe8; border-top:0 none; overflow:hidden; padding:2px; } .x-panel-tbar .x-toolbar { border:1px solid #99bbe8; border-top:0 none; overflow:hidden; padding:2px; } .x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar { border-top:1px solid #99bbe8; border-bottom: 0 none; } .x-panel-body-noheader, .x-panel-mc .x-panel-body { border-top:1px solid #99bbe8; } .x-panel-header { overflow:hidden; zoom:1; } .x-panel-tl .x-panel-header { color:#15428b; font:bold 11px tahoma,arial,verdana,sans-serif; padding:5px 0 4px 0; border:0 none; background:transparent; } .x-panel-tl .x-panel-icon, .x-window-tl .x-panel-icon { padding-left:20px !important; background-repeat:no-repeat; background-position:0 4px; zoom:1; } .x-panel-inline-icon { width:16px; height:16px; background-repeat:no-repeat; background-position:0 0; vertical-align:middle; margin-right:4px; margin-top:-1px; margin-bottom:-1px; } .x-panel-tc { background: transparent url(../images/default/panel/top-bottom.gif) repeat-x 0 0; overflow:hidden; } /* fix ie7 strict mode bug */ .ext-strict .ext-ie7 .x-panel-tc { overflow: visible; } .x-panel-tl { background: transparent url(../images/default/panel/corners-sprite.gif) no-repeat 0 0; padding-left:6px; zoom:1; border-bottom:1px solid #99bbe8; } .x-panel-tr { background: transparent url(../images/default/panel/corners-sprite.gif) no-repeat right 0; zoom:1; padding-right:6px; } .x-panel-bc { background: transparent url(../images/default/panel/top-bottom.gif) repeat-x 0 bottom; zoom:1; } .x-panel-bc .x-panel-footer { zoom:1; } .x-panel-bl { background: transparent url(../images/default/panel/corners-sprite.gif) no-repeat 0 bottom; padding-left:6px; zoom:1; } .x-panel-br { background: transparent url(../images/default/panel/corners-sprite.gif) no-repeat right bottom; padding-right:6px; zoom:1; } .x-panel-mc { border:0 none; padding:0; margin:0; font: normal 11px tahoma,arial,helvetica,sans-serif; padding-top:6px; background:#dfe8f6; } .x-panel-mc .x-panel-body { background:transparent; border: 0 none; } .x-panel-ml { background: #fff url(../images/default/panel/left-right.gif) repeat-y 0 0; padding-left:6px; zoom:1; } .x-panel-mr { background: transparent url(../images/default/panel/left-right.gif) repeat-y right 0; padding-right:6px; zoom:1; } .x-panel-bc .x-panel-footer { padding-bottom:6px; } .x-panel-nofooter .x-panel-bc { height:6px; font-size:0; line-height:0; } .x-panel-bwrap { overflow:hidden; zoom:1; } .x-panel-body { overflow:hidden; zoom:1; } .x-panel-collapsed .x-resizable-handle{ display:none; } .ext-gecko .x-panel-animated div { overflow:hidden !important; } /* Plain */ .x-plain-body { overflow:hidden; } .x-plain-bbar .x-toolbar { overflow:hidden; padding:2px; } .x-plain-tbar .x-toolbar { overflow:hidden; padding:2px; } .x-plain-bwrap { overflow:hidden; zoom:1; } .x-plain { overflow:hidden; } /* Tools */ .x-tool { overflow:hidden; width:15px; height:15px; float:right; cursor:pointer; background:transparent url(../images/default/panel/tool-sprites.gif) no-repeat; margin-left:2px; } /* expand / collapse tools */ .x-tool-toggle { background-position:0 -60px; } .x-tool-toggle-over { background-position:-15px -60px; } .x-panel-collapsed .x-tool-toggle { background-position:0 -75px; } .x-panel-collapsed .x-tool-toggle-over { background-position:-15px -75px; } .x-tool-close { background-position:0 -0; } .x-tool-close-over { background-position:-15px 0; } .x-tool-minimize { background-position:0 -15px; } .x-tool-minimize-over { background-position:-15px -15px; } .x-tool-maximize { background-position:0 -30px; } .x-tool-maximize-over { background-position:-15px -30px; } .x-tool-restore { background-position:0 -45px; } .x-tool-restore-over { background-position:-15px -45px; } .x-tool-gear { background-position:0 -90px; } .x-tool-gear-over { background-position:-15px -90px; } .x-tool-pin { background-position:0 -135px; } .x-tool-pin-over { background-position:-15px -135px; } .x-tool-unpin { background-position:0 -150px; } .x-tool-unpin-over { background-position:-15px -150px; } .x-tool-right { background-position:0 -165px; } .x-tool-right-over { background-position:-15px -165px; } .x-tool-left { background-position:0 -180px; } .x-tool-left-over { background-position:-15px -180px; } .x-tool-up { background-position:0 -210px; } .x-tool-up-over { background-position:-15px -210px; } .x-tool-down { background-position:0 -195px; } .x-tool-down-over { background-position:-15px -195px; } .x-tool-refresh { background-position:0 -225px; } .x-tool-refresh-over { background-position:-15px -225px; } .x-tool-minus { background-position:0 -255px; } .x-tool-minus-over { background-position:-15px -255px; } .x-tool-plus { background-position:0 -240px; } .x-tool-plus-over { background-position:-15px -240px; } .x-tool-search { background-position:0 -270px; } .x-tool-search-over { background-position:-15px -270px; } .x-tool-save { background-position:0 -285px; } .x-tool-save-over { background-position:-15px -285px; } .x-tool-help { background-position:0 -300px; } .x-tool-help-over { background-position:-15px -300px; } .x-tool-print { background-position:0 -315px; } .x-tool-print-over { background-position:-15px -315px; } /* Ghosting */ .x-panel-ghost { background:#cbddf3; z-index:12000; overflow:hidden; position:absolute; left:0;top:0; opacity:.65; -moz-opacity:.65; filter:alpha(opacity=65); } .x-panel-ghost ul { margin:0; padding:0; overflow:hidden; font-size:0; line-height:0; border:1px solid #99bbe8; border-top:0 none; display:block; } .x-panel-ghost * { cursor:move !important; } .x-panel-dd-spacer { border:2px dashed #99bbe8; } /* Buttons */ .x-panel-btns-ct { padding:5px; } .x-panel-btns-ct .x-btn{ float:right; clear:none; } .x-panel-btns-ct .x-panel-btns td { border:0; padding:0; } .x-panel-btns-ct .x-panel-btns-right table{ float:right; clear:none; } .x-panel-btns-ct .x-panel-btns-left table{ float:left; clear:none; } .x-panel-btns-ct .x-panel-btns-center{ text-align:center; /*ie*/ } .x-panel-btns-ct .x-panel-btns-center table{ margin:0 auto; /*everyone else*/ } .x-panel-btns-ct table td.x-panel-btn-td{ padding:3px; } .x-panel-btns-ct .x-btn-focus .x-btn-left{ background-position:0 -147px; } .x-panel-btns-ct .x-btn-focus .x-btn-right{ background-position:0 -168px; } .x-panel-btns-ct .x-btn-focus .x-btn-center{ background-position:0 -189px; } .x-panel-btns-ct .x-btn-over .x-btn-left{ background-position:0 -63px; } .x-panel-btns-ct .x-btn-over .x-btn-right{ background-position:0 -84px; } .x-panel-btns-ct .x-btn-over .x-btn-center{ background-position:0 -105px; } .x-panel-btns-ct .x-btn-click .x-btn-center{ background-position:0 -126px; } .x-panel-btns-ct .x-btn-click .x-btn-right{ background-position:0 -84px; } .x-panel-btns-ct .x-btn-click .x-btn-left{ background-position:0 -63px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/panel.css
CSS
mit
8,541
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-toolbar{ border-color:#a9bfd3; border-style:solid; border-width:0 0 1px 0; display: block; padding:2px; background:#d0def0 url(../images/default/toolbar/bg.gif) repeat-x top left; position:fixed; top:0px; left:0px; zoom:1; } .x-toolbar .x-item-disabled .x-btn-icon { opacity: .35; -moz-opacity: .35; filter: alpha(opacity=35); } .x-toolbar td { vertical-align:middle; } .mso .x-toolbar, .x-grid-mso .x-toolbar{ border: 0 none; background: url(../images/default/grid/mso-hd.gif); } .x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{ white-space: nowrap; font:normal 11px tahoma, arial, helvetica, sans-serif; } .x-toolbar .x-item-disabled { color:gray; cursor:default; opacity:.6; -moz-opacity:.6; filter:alpha(opacity=60); } .x-toolbar .x-item-disabled * { color:gray; cursor:default; } .x-toolbar .x-btn-left{ background:none; } .x-toolbar .x-btn-right{ background:none; } .x-toolbar .x-btn-center{ background:none; padding:0 0; } .x-toolbar .x-btn-menu-text-wrap .x-btn-center button{ padding-right:2px; } .ext-gecko .x-toolbar .x-btn-menu-text-wrap .x-btn-center button{ padding-right:0; } .x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button{ padding:0 2px; } .x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button { width:12px; background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat 0 3px; } .x-toolbar .x-btn-text-icon .x-btn-menu-arrow-wrap .x-btn-center button { width:12px; background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat 0 3px; } .x-toolbar .x-btn-over .x-btn-menu-arrow-wrap .x-btn-center button { background-position: 0 -47px; } .x-toolbar .x-btn-over .x-btn-left{ background: url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 0; } .x-toolbar .x-btn-over .x-btn-right{ background: url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -21px; } .x-toolbar .x-btn-over .x-btn-center{ background: url(../images/default/toolbar/tb-btn-sprite.gif) repeat-x 0 -42px; } .x-toolbar .x-btn-click .x-btn-left, .x-toolbar .x-btn-pressed .x-btn-left, .x-toolbar .x-btn-menu-active .x-btn-left{ background: url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -63px; } .x-toolbar .x-btn-click .x-btn-right, .x-toolbar .x-btn-pressed .x-btn-right, .x-toolbar .x-btn-menu-active .x-btn-right{ background: url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -84px; } .x-toolbar .x-btn-click .x-btn-center, .x-toolbar .x-btn-pressed .x-btn-center, .x-toolbar .x-btn-menu-active .x-btn-center{ background: url(../images/default/toolbar/tb-btn-sprite.gif) repeat-x 0 -105px; } .x-toolbar .x-btn-with-menu .x-btn-center em{ padding-right:8px; } .x-toolbar .ytb-text{ padding:2px; } .x-toolbar .ytb-sep { background-image: url(../images/default/grid/grid-blue-split.gif); background-position: center; background-repeat: no-repeat; display: block; font-size: 1px; height: 16px; width:4px; overflow: hidden; cursor:default; margin: 0 2px 0; border:0; } .x-toolbar .ytb-spacer { width:2px; } /* Paging Toolbar */ .x-tbar-page-number{ width:24px; height:14px; } .x-tbar-page-first{ background-image: url(../images/default/grid/page-first.gif) !important; } .x-tbar-loading{ background-image: url(../images/default/grid/done.gif) !important; } .x-tbar-page-last{ background-image: url(../images/default/grid/page-last.gif) !important; } .x-tbar-page-next{ background-image: url(../images/default/grid/page-next.gif) !important; } .x-tbar-page-prev{ background-image: url(../images/default/grid/page-prev.gif) !important; } .x-item-disabled .x-tbar-loading{ background-image: url(../images/default/grid/loading.gif) !important; } .x-item-disabled .x-tbar-page-first{ background-image: url(../images/default/grid/page-first-disabled.gif) !important; } .x-item-disabled .x-tbar-page-last{ background-image: url(../images/default/grid/page-last-disabled.gif) !important; } .x-item-disabled .x-tbar-page-next{ background-image: url(../images/default/grid/page-next-disabled.gif) !important; } .x-item-disabled .x-tbar-page-prev{ background-image: url(../images/default/grid/page-prev-disabled.gif) !important; } .x-paging-info { position:absolute; top:5px; right: 8px; color:#444; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/toolbar.css
CSS
mit
4,641
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .ORYX_Editor .x-panel-bwrap { display: none; } .x-panel { border-style: solid; border-color: #d0d0d0; } .x-panel-header { color:#333; border:1px solid #d0d0d0; background-image:url(../images/gray/panel/white-top-bottom.gif); } .x-panel-body { border-color:#d0d0d0; } .x-panel-bbar .x-toolbar { border-color:#d0d0d0; } .x-panel-tbar .x-toolbar { border-color:#d0d0d0; } .x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar { border-color:#d0d0d0; } .x-panel-body-noheader, .x-panel-mc .x-panel-body { border-color:#d0d0d0; } .x-panel-tl .x-panel-header { color:#333; } .x-panel-tc { background-image:url(../images/gray/panel/top-bottom.gif); } .x-panel-tl { background-image:url(../images/gray/panel/corners-sprite.gif); border-color:#d0d0d0; } .x-panel-tr { background-image:url(../images/gray/panel/corners-sprite.gif); } .x-panel-bc { background-image:url(../images/gray/panel/top-bottom.gif); } .x-panel-bl { background-image:url(../images/gray/panel/corners-sprite.gif); } .x-panel-br { background-image:url(../images/gray/panel/corners-sprite.gif); } .x-panel-mc { background:#f1f1f1; } .x-panel-mc .x-panel-body { background:transparent; border: 0 none; } .x-panel-ml { background-image:url(../images/gray/panel/left-right.gif); } .x-panel-mr { background-image:url(../images/gray/panel/left-right.gif); } /* Tools */ .x-tool { background-image:url(../images/gray/panel/tool-sprites.gif); } /* Ghosting */ .x-panel-ghost { background:#e0e0e0; } .x-panel-ghost ul { border-color:#b0b0b0; } .x-grid-panel .x-panel-mc .x-panel-body { border:1px solid #d0d0d0; } /* Buttons */ .x-btn-left{ background-image:url(../images/gray/button/btn-sprite.gif); } .x-btn-right{ background-image:url(../images/gray/button/btn-sprite.gif); } .x-btn-center{ background-image:url(../images/gray/button/btn-sprite.gif); } /* Layout classes */ .x-border-layout-ct { background:#f0f0f0; } .x-accordion-hd { background-image:url(../images/gray/panel/light-hd.gif); } .x-layout-collapsed{ background-color:#eee; border-color:#e0e0e0; } .x-layout-collapsed-over{ background-color:#fbfbfb; } /* qtips */ .x-tip .x-tip-top { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-top-left { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-top-right { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-ft { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-ft-left { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-ft-right { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-bd-left { background-image:url(../images/gray/qtip/tip-sprite.gif); } .x-tip .x-tip-bd-right { background-image:url(../images/gray/qtip/tip-sprite.gif); } /* Toolbars */ .x-toolbar{ border-color:#d0d0d0; background:#f0f4f5 url(../images/gray/toolbar/bg.gif) repeat-x top left; } .x-toolbar button { color:#444; } .x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button { background-image:url(../images/gray/toolbar/btn-arrow.gif); } .x-toolbar .x-btn-text-icon .x-btn-menu-arrow-wrap .x-btn-center button { background-image:url(../images/gray/toolbar/btn-arrow.gif); } .x-toolbar .x-btn-over .x-btn-left{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .x-btn-over .x-btn-right{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .x-btn-over .x-btn-center{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .x-btn-over button { color:#111; } .x-toolbar .x-btn-click .x-btn-left, .x-toolbar .x-btn-pressed .x-btn-left, .x-toolbar .x-btn-menu-active .x-btn-left{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .x-btn-click .x-btn-right, .x-toolbar .x-btn-pressed .x-btn-right, .x-toolbar .x-btn-menu-active .x-btn-right{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .x-btn-click .x-btn-center, .x-toolbar .x-btn-pressed .x-btn-center, .x-toolbar .x-btn-menu-active .x-btn-center{ background-image:url(../images/gray/toolbar/tb-btn-sprite.gif); } .x-toolbar .ytb-sep { background-image: url(../images/default/grid/grid-split.gif); } /* Tabs */ .x-tab-panel-header, .x-tab-panel-footer { background: #EAEAEA; border-color:#d0d0d0; } .x-tab-panel-header { border-color:#d0d0d0; } .x-tab-panel-footer { border-color:#d0d0d0; } ul.x-tab-strip-top{ background:#dbdbdb url(../images/gray/tabs/tab-strip-bg.gif) repeat-x left top; border-color:#d0d0d0; padding-top: 2px; } ul.x-tab-strip-bottom{ background-image:url(../images/gray/tabs/tab-strip-btm-bg.gif); border-color:#d0d0d0; } .x-tab-strip span.x-tab-strip-text { color:#333; } .x-tab-strip-over span.x-tab-strip-text { color:#111; } .x-tab-strip-active span.x-tab-strip-text { color:#333; } .x-tab-strip-disabled .x-tabs-text { color:#aaaaaa; } .x-tab-strip-top .x-tab-right { background-image:url(../images/gray/tabs/tabs-sprite.gif); } .x-tab-strip-top .x-tab-left { background-image:url(../images/gray/tabs/tabs-sprite.gif); } .x-tab-strip-top .x-tab-strip-inner { background-image:url(../images/gray/tabs/tabs-sprite.gif); } .x-tab-strip-bottom .x-tab-right { background-image:url(../images/gray/tabs/tab-btm-inactive-right-bg.gif); } .x-tab-strip-bottom .x-tab-left { background-image:url(../images/gray/tabs/tab-btm-inactive-left-bg.gif); } .x-tab-strip-bottom .x-tab-strip-active .x-tab-right { background-image:url(../images/gray/tabs/tab-btm-right-bg.gif); } .x-tab-strip-bottom .x-tab-strip-active .x-tab-left { background-image:url(../images/gray/tabs/tab-btm-left-bg.gif); } .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close { background-image:url(../images/gray/tabs/tab-close.gif); } .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close:hover{ background-image:url(../images/gray/tabs/tab-close.gif); } .x-tab-panel-body { border-color:#d0d0d0; background:#fff; } .x-tab-panel-bbar .x-toolbar { border-color: #d0d0d0; } .x-tab-panel-tbar .x-toolbar { border-color: #d0d0d0; } .x-tab-panel-header-plain .x-tab-strip-spacer { border-color:#d0d0d0; background: #eaeaea; } .x-tab-scroller-left { background-image: url(../images/gray/tabs/scroll-left.gif); border-color:#aeaeae; } .x-tab-scroller-right { background-image: url(../images/gray/tabs/scroll-right.gif); border-color:#aeaeae; } /* Window */ .x-window-proxy { background:#e0e0e0; border-color:#b0b0b0; } .x-window-tl .x-window-header { color:#555; } .x-window-tc { background-image:url(../images/gray/window/top-bottom.png); } .x-window-tl { background-image:url(../images/gray/window/left-corners.png); } .x-window-tr { background-image:url(../images/gray/window/right-corners.png); } .x-window-bc { background-image:url(../images/gray/window/top-bottom.png); } .x-window-bl { background-image:url(../images/gray/window/left-corners.png); } .x-window-br { background-image:url(../images/gray/window/right-corners.png); } .x-window-mc { border:1px solid #d0d0d0; background:#e8e8e8; } .x-window-ml { background-image:url(../images/gray/window/left-right.png); } .x-window-mr { background-image:url(../images/gray/window/left-right.png); } .x-panel-ghost .x-window-tl { border-color:#d0d0d0; } .x-panel-collapsed .x-window-tl { border-color:#d0d0d0; } .x-window-plain .x-window-mc { background: #e8e8e8; border-right:1px solid #eee; border-bottom:1px solid #eee; border-top:1px solid #d0d0d0; border-left:1px solid #d0d0d0; } .x-window-plain .x-window-body { border-left:1px solid #eee; border-top:1px solid #eee; border-bottom:1px solid #d0d0d0; border-right:1px solid #d0d0d0; background:transparent !important; } body.x-body-masked .x-window-mc, body.x-body-masked .x-window-plain .x-window-mc { background-color: #e4e4e4; } /* misc */ .x-html-editor-wrap { border-color:#d0d0d0; } /* Borders go last for specificity */ .x-panel-noborder .x-panel-body-noborder { border-width:0; } .x-panel-noborder .x-panel-header-noborder { border-width:0; border-bottom:1px solid #d0d0d0; } .x-panel-noborder .x-panel-tbar-noborder .x-toolbar { border-width:0; border-bottom:1px solid #d0d0d0; } .x-panel-noborder .x-panel-bbar-noborder .x-toolbar { border-width:0; border-top:1px solid #d0d0d0; } .x-window-noborder .x-window-mc { border-width:0; } .x-window-plain .x-window-body-noborder { border-width:0; } .x-tab-panel-noborder .x-tab-panel-body-noborder { border-width:0; } .x-tab-panel-noborder .x-tab-panel-header-noborder { border-top-width:0; border-left-width:0; border-right-width:0; } .x-tab-panel-noborder .x-tab-panel-footer-noborder { border-bottom-width:0; border-left-width:0; border-right-width:0; } .x-tab-panel-bbar-noborder .x-toolbar { border-width:0; border-top:1px solid #d0d0d0; } .x-tab-panel-tbar-noborder .x-toolbar { border-width:0; border-bottom:1px solid #d0d0d0; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/xtheme-gray.css
CSS
mit
9,716
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-btn{ font:normal 11px tahoma, verdana, helvetica; cursor:pointer; white-space: nowrap; } .x-btn button{ border:0 none; background:transparent; font:normal 11px tahoma,verdana,helvetica; padding-left:3px; padding-right:3px; cursor:pointer; margin:0; overflow:visible; width:auto; -moz-outline:0 none; outline:0 none; } * html .ext-ie .x-btn button { width:1px; } .ext-gecko .x-btn button { padding-left:0; padding-right:0; } .ext-ie .x-btn button { padding-top:2px; } /* Predefined css class for buttons with only icon. Add this class (x-btn-icon) and a class with a background-image to your button for a button with just an icon. e.g. .my-class .x-btn-text { background-image: url(foo.gif); } */ .x-btn-icon .x-btn-center .x-btn-text{ background-position: center; background-repeat: no-repeat; height: 16px; width: 16px; cursor:pointer; white-space: nowrap; padding:0; } .x-btn-icon .x-btn-center{ padding:1px; } .x-btn em { font-style:normal; font-weight:normal; } /* Button class for icon and text. Add this class (x-btn-text-icon) and a class with a background-image to your button for both text and icon. */ .x-btn-text-icon .x-btn-center .x-btn-text{ background-position: 0 2px; background-repeat: no-repeat; padding-left:18px; padding-top:3px; padding-bottom:2px; padding-right:0; } .x-btn-left, .x-btn-right{ font-size:1px; line-height:1px; } .x-btn-left{ width:3px; height:21px; background:url(../images/default/button/btn-sprite.gif) no-repeat 0 0; } .x-btn-right{ width:3px; height:21px; background:url(../images/default/button/btn-sprite.gif) no-repeat 0 -21px; } .x-btn-left i, .x-btn-right i{ display:block; width:3px; overflow:hidden; font-size:1px; line-height:1px; } .x-btn-center{ background:url(../images/default/button/btn-sprite.gif) repeat-x 0 -42px; vertical-align: middle; text-align:center; padding:0 5px; cursor:pointer; white-space:nowrap; } .x-btn-over .x-btn-left{ background-position:0 -63px; } .x-btn-over .x-btn-right{ background-position:0 -84px; } .x-btn-over .x-btn-center{ background-position:0 -105px; } .x-btn-click .x-btn-center, .x-btn-menu-active .x-btn-center{ background-position:0 -126px; } .x-btn-disabled *{ color:gray !important; cursor:default !important; } .x-btn-menu-text-wrap .x-btn-center { padding:0 3px; } .ext-gecko .x-btn-menu-text-wrap .x-btn-center { padding:0 1px; } .x-btn-menu-arrow-wrap .x-btn-center { padding:0; } .x-btn-menu-arrow-wrap .x-btn-center button { width:12px !important; height:21px; padding:0 !important; display:block; background:transparent url(../images/default/button/btn-arrow.gif) no-repeat left 3px; } .x-btn-with-menu .x-btn-center { padding-right:2px !important; } .x-btn-with-menu .x-btn-center em { display:block; background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat right 0; padding-right:10px; } .x-btn-text-icon .x-btn-with-menu .x-btn-center em { display:block; background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat right 3px; padding-right:10px; } /* Toggle button styles */ .x-btn-pressed .x-btn-left{ background: url(../images/default/button/btn-sprite.gif) no-repeat 0 -63px; } .x-btn-pressed .x-btn-right{ background: url(../images/default/button/btn-sprite.gif) no-repeat 0 -84px; } .x-btn-pressed .x-btn-center{ background: url(../images/default/button/btn-sprite.gif) repeat-x 0 -126px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/button.css
CSS
mit
3,820
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-tab-panel { overflow:hidden; } .x-tab-panel-header, .x-tab-panel-footer { background: #deecfd; border: 1px solid #8db2e3; overflow:hidden; zoom:1; } .x-tab-panel-header { border: 1px solid #8db2e3; padding-bottom: 2px; } .x-tab-panel-footer { border: 1px solid #8db2e3; padding-top: 2px; } .x-tab-strip-wrap { width:100%; overflow:hidden; position:relative; zoom:1; } ul.x-tab-strip { display:block; width:5000px; zoom:1; } ul.x-tab-strip-top{ padding-top: 1px; background: url(../images/default/tabs/tab-strip-bg.gif) #cedff5 repeat-x bottom; border-bottom: 1px solid #8db2e3; } ul.x-tab-strip-bottom{ padding-bottom: 1px; background: url(../images/default/tabs/tab-strip-btm-bg.gif) #cedff5 repeat-x top; border-top: 1px solid #8db2e3; border-bottom: 0 none; } .x-tab-panel-header-plain .x-tab-strip-top { background:transparent !important; padding-top:0 !important; } .x-tab-panel-header-plain { background:transparent !important; border-width:0 !important; padding-bottom:0 !important; } .x-tab-panel-header-plain .x-tab-strip-spacer { border:1px solid #8db2e3; border-top: 0 none; height:2px; background: #deecfd; font-size:1px; line-height:1px; } .ext-border-box .x-tab-panel-header-plain .x-tab-strip-spacer { height:3px; } ul.x-tab-strip li { float:left; margin-left:2px; } ul.x-tab-strip li.x-tab-edge { float:left; margin:0 !important; padding:0 !important; border:0 none !important; font-size:1px !important; line-height:1px !important; overflow:hidden; zoom:1; background:transparent !important; width:1px; } .x-tab-strip a, .x-tab-strip span, .x-tab-strip em { display:block; } .x-tab-strip a { text-decoration:none !important; -moz-outline: none; outline: none; cursor:pointer; } .x-tab-strip-inner { overflow:hidden; text-overflow: ellipsis; } .x-tab-strip span.x-tab-strip-text { font:normal 11px tahoma,arial,helvetica; color:#416aa3; white-space: nowrap; cursor:pointer; padding:4px 0; } .x-tab-strip .x-tab-with-icon .x-tab-right { padding-left:6px; } .x-tab-strip .x-tab-with-icon span.x-tab-strip-text { padding-left:20px; background-position: 0 3px; background-repeat: no-repeat; } .x-tab-strip-over span.x-tab-strip-text { color:#15428b; } .x-tab-strip-active { cursor:default; } .x-tab-strip-active span.x-tab-strip-text { cursor:default; color:#15428b; font-weight:bold; } .x-tab-strip-disabled .x-tabs-text { cursor:default; color:#aaaaaa; } .x-tab-panel-body { overflow:hidden; } .x-tab-panel-bwrap { overflow:hidden; } .ext-ie .x-tab-strip .x-tab-right { position:relative; } .x-tab-strip-top .x-tab-strip-active .x-tab-right { margin-bottom:-1px; } .x-tab-strip-top .x-tab-strip-active .x-tab-right span.x-tab-strip-text { padding-bottom:5px; } .x-tab-strip-bottom .x-tab-strip-active .x-tab-right { margin-top:-1px; } .x-tab-strip-bottom .x-tab-strip-active .x-tab-right span.x-tab-strip-text { padding-top:5px; } .x-tab-strip-top .x-tab-right { background: transparent url(../images/default/tabs/tabs-sprite.gif) no-repeat 0 -51px; padding-left:10px; } .x-tab-strip-top .x-tab-left { background: transparent url(../images/default/tabs/tabs-sprite.gif) no-repeat right -351px; padding-right:10px; } .x-tab-strip-top .x-tab-strip-inner { background: transparent url(../images/default/tabs/tabs-sprite.gif) repeat-x 0 -201px; } .x-tab-strip-top .x-tab-strip-over .x-tab-right { background-position:0 -101px; } .x-tab-strip-top .x-tab-strip-over .x-tab-left { background-position:right -401px; } .x-tab-strip-top .x-tab-strip-over .x-tab-strip-inner { background-position:0 -251px; } .x-tab-strip-top .x-tab-strip-active .x-tab-right { background-position: 0 0; } .x-tab-strip-top .x-tab-strip-active .x-tab-left { background-position: right -301px; } .x-tab-strip-top .x-tab-strip-active .x-tab-strip-inner { background-position: 0 -151px; } .x-tab-strip-bottom .x-tab-right { background: url(../images/default/tabs/tab-btm-inactive-right-bg.gif) no-repeat bottom right; } .x-tab-strip-bottom .x-tab-left { background: url(../images/default/tabs/tab-btm-inactive-left-bg.gif) no-repeat bottom left; } .x-tab-strip-bottom .x-tab-strip-active .x-tab-right { background: url(../images/default/tabs/tab-btm-right-bg.gif) no-repeat bottom left; } .x-tab-strip-bottom .x-tab-strip-active .x-tab-left { background: url(../images/default/tabs/tab-btm-left-bg.gif) no-repeat bottom right; } .x-tab-strip-bottom .x-tab-left { padding:0 10px; } .x-tab-strip-bottom .x-tab-right { padding:0; } .x-tab-strip .x-tab-strip-close { display:none; } .x-tab-strip-closable { position:relative; } .x-tab-strip-closable .x-tab-left { padding-right:19px; } .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close { background-image:url(../images/default/tabs/tab-close.gif); opacity:.6; -moz-opacity:.6; background-repeat:no-repeat; display:block; width:11px;height:11px; position:absolute; top:3px; right:3px; cursor:pointer; z-index:2; } .x-tab-strip .x-tab-strip-active a.x-tab-strip-close { opacity:.8; -moz-opacity:.8; } .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close:hover{ background-image:url(../images/default/tabs/tab-close.gif); opacity:1; -moz-opacity:1; } .x-tab-panel-body { border: 1px solid #8db2e3; background:#fff; } .x-tab-panel-body-top { border-top: 0 none; } .x-tab-panel-body-bottom { border-bottom: 0 none; } .x-tab-scroller-left { background: transparent url(../images/default/tabs/scroll-left.gif) no-repeat -18px 0; border-bottom: 1px solid #8db2e3; width:18px; position:absolute; left:0; top:0; z-index:10; cursor:pointer; } .x-tab-scroller-left-over { background-position: 0 0; } .x-tab-scroller-left-disabled { background-position: -18px 0; opacity:.5; -moz-opacity:.5; filter:alpha(opacity=50); cursor:default; } .x-tab-scroller-right { background: transparent url(../images/default/tabs/scroll-right.gif) no-repeat 0 0; border-bottom: 1px solid #8db2e3; width:18px; position:absolute; right:0; top:0; z-index:10; cursor:pointer; } .x-tab-scroller-right-over { background-position: -18px 0; } .x-tab-scroller-right-disabled { background-position: 0 0; opacity:.5; -moz-opacity:.5; filter:alpha(opacity=50); cursor:default; } .x-tab-scrolling .x-tab-strip-wrap { margin-left:18px; margin-right:18px; } .x-tab-scrolling { position:relative; } .x-tab-panel-bbar .x-toolbar { border:1px solid #99bbe8; border-top:0 none; overflow:hidden; padding:2px; } .x-tab-panel-tbar .x-toolbar { border:1px solid #99bbe8; border-top:0 none; overflow:hidden; padding:2px; } .x-border-layout-ct .x-tab-panel { background: white; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/tabs.css
CSS
mit
7,469
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-dd-drag-proxy{ position:absolute; left:0;top:0; visibility:hidden; z-index:15000; } .x-dd-drag-ghost{ color: black; font: normal 11px arial, helvetica, sans-serif; -moz-opacity: 0.85; opacity:.85; filter: alpha(opacity=85); border-top:1px solid #dddddd; border-left:1px solid #dddddd; border-right:1px solid #bbbbbb; border-bottom:1px solid #bbbbbb; padding:3px; padding-left:20px; background-color:white; white-space:nowrap; } .x-dd-drag-repair .x-dd-drag-ghost{ -moz-opacity: 0.4; opacity:.4; filter: alpha(opacity=40); border:0 none; padding:0; background-color:transparent; } .x-dd-drag-repair .x-dd-drop-icon{ visibility:hidden; } .x-dd-drop-icon{ position:absolute; top:3px; left:3px; display:block; width:16px; height:16px; background-color:transparent; background-position: center; background-repeat: no-repeat; z-index:1; } .x-dd-drop-nodrop .x-dd-drop-icon{ background-image: url(../images/default/dd/drop-no.gif); } .x-dd-drop-ok .x-dd-drop-icon{ background-image: url(../images/default/dd/drop-yes.gif); } .x-dd-drop-ok-add .x-dd-drop-icon{ background-image: url(../images/default/dd/drop-add.gif); } .x-view-selector { position:absolute; left:0; top:0; width:0; background:#c3daf9; border:1px dotted #3399bb; opacity: .5; -moz-opacity: .5; filter:alpha(opacity=50); zoom:1; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/dd.css
CSS
mit
1,580
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-panel-noborder .x-panel-body-noborder { border-width:0; } .x-panel-noborder .x-panel-header-noborder { border-width:0; border-bottom:1px solid #99bbe8; } .x-panel-noborder .x-panel-tbar-noborder .x-toolbar { border-width:0; border-bottom:1px solid #99bbe8; } .x-panel-noborder .x-panel-bbar-noborder .x-toolbar { border-width:0; border-top:1px solid #99bbe8; } .x-window-noborder .x-window-mc { border-width:0; } .x-window-plain .x-window-body-noborder { border-width:0; } .x-tab-panel-noborder .x-tab-panel-body-noborder { border-width:0; } .x-tab-panel-noborder .x-tab-panel-header-noborder { border-top-width:0; border-left-width:0; border-right-width:0; } .x-tab-panel-noborder .x-tab-panel-footer-noborder { border-bottom-width:0; border-left-width:0; border-right-width:0; } .x-tab-panel-bbar-noborder .x-toolbar { border-width:0; border-top:1px solid #99bbe8; } .x-tab-panel-tbar-noborder .x-toolbar { border-width:0; border-bottom:1px solid #99bbe8; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/borders.css
CSS
mit
1,219
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}img,body,html{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';}
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/reset.css
CSS
mit
473
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-resizable-handle { position:absolute; z-index:100; /* ie needs these */ font-size:1px; line-height:6px; overflow:hidden; background:white; filter:alpha(opacity=0); opacity:0; zoom:1; } .x-resizable-handle-east{ width:6px; cursor:e-resize; right:0; top:0; height:100%; } .ext-ie .x-resizable-handle-east { margin-right:-1px; /*IE rounding error*/ } .x-resizable-handle-south{ width:100%; cursor:s-resize; left:0; bottom:0; height:6px; } .ext-ie .x-resizable-handle-south { margin-bottom:-1px; /*IE rounding error*/ } .x-resizable-handle-west{ width:6px; cursor:w-resize; left:0; top:0; height:100%; } .x-resizable-handle-north{ width:100%; cursor:n-resize; left:0; top:0; height:6px; } .x-resizable-handle-southeast{ width:6px; cursor:se-resize; right:0; bottom:0; height:6px; z-index:101; } .x-resizable-handle-northwest{ width:6px; cursor:nw-resize; left:0; top:0; height:6px; z-index:101; } .x-resizable-handle-northeast{ width:6px; cursor:ne-resize; right:0; top:0; height:6px; z-index:101; } .x-resizable-handle-southwest{ width:6px; cursor:sw-resize; left:0; bottom:0; height:6px; z-index:101; } .x-resizable-over .x-resizable-handle, .x-resizable-pinned .x-resizable-handle{ filter:alpha(opacity=100); opacity:1; } .x-resizable-over .x-resizable-handle-east, .x-resizable-pinned .x-resizable-handle-east{ background:url(../images/default/sizer/e-handle.gif); background-position: left; } .x-resizable-over .x-resizable-handle-west, .x-resizable-pinned .x-resizable-handle-west{ background:url(../images/default/sizer/e-handle.gif); background-position: left; } .x-resizable-over .x-resizable-handle-south, .x-resizable-pinned .x-resizable-handle-south{ background:url(../images/default/sizer/s-handle.gif); background-position: top; } .x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north{ background:url(../images/default/sizer/s-handle.gif); background-position: top; } .x-resizable-over .x-resizable-handle-southeast, .x-resizable-pinned .x-resizable-handle-southeast{ background:url(../images/default/sizer/se-handle.gif); background-position: top left; } .x-resizable-over .x-resizable-handle-northwest, .x-resizable-pinned .x-resizable-handle-northwest{ background:url(../images/default/sizer/nw-handle.gif); background-position:bottom right; } .x-resizable-over .x-resizable-handle-northeast, .x-resizable-pinned .x-resizable-handle-northeast{ background:url(../images/default/sizer/ne-handle.gif); background-position: bottom left; } .x-resizable-over .x-resizable-handle-southwest, .x-resizable-pinned .x-resizable-handle-southwest{ background:url(../images/default/sizer/sw-handle.gif); background-position: top right; } .x-resizable-proxy{ border: 1px dashed #3b5a82; position:absolute; overflow:hidden; display:none; left:0;top:0; z-index:50000; } .x-resizable-overlay{ width:100%; height:100%; display:none; position:absolute; left:0; top:0; background:white; z-index:200000; -moz-opacity: 0; opacity:0; filter: alpha(opacity=0); }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/resizable.css
CSS
mit
3,596
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-tree .x-panel-body{ background-color:#fff; } .ext-strict .ext-ie .x-tree .x-panel-bwrap{ position:relative; overflow:hidden; } .x-tree-icon, .x-tree-ec-icon, .x-tree-elbow-line, .x-tree-elbow, .x-tree-elbow-end, .x-tree-elbow-plus, .x-tree-elbow-minus, .x-tree-elbow-end-plus, .x-tree-elbow-end-minus{ border: 0 none; height: 18px; margin: 0; padding: 0; vertical-align: top; width: 16px; background-repeat: no-repeat; } .x-tree-node-collapsed .x-tree-node-icon, .x-tree-node-expanded .x-tree-node-icon, .x-tree-node-leaf .x-tree-node-icon{ border: 0 none; height: 18px; margin: 0; padding: 0; vertical-align: top; width: 16px; background-position:center; background-repeat: no-repeat; } .ext-ie .x-tree-node-indent img, .ext-ie .x-tree-node-icon, .ext-ie .x-tree-ec-icon { vertical-align:middle !important; } /* some default icons for leaf/folder */ .x-tree-node-expanded .x-tree-node-icon{ background-image:url(../images/default/tree/folder-open.gif); } .x-tree-node-leaf .x-tree-node-icon{ background-image:url(../images/default/tree/leaf.gif); } .x-tree-node-collapsed .x-tree-node-icon{ background-image:url(../images/default/tree/folder.gif); } /* checkboxes */ .ext-ie input.x-tree-node-cb { width:15px; height:15px; } input.x-tree-node-cb { margin-left:1px; } .ext-ie input.x-tree-node-cb { margin-left:0; } .x-tree-noicon .x-tree-node-icon{ width:0; height:0; } /* loading icon */ .x-tree-node-loading .x-tree-node-icon{ background-image:url(../images/default/tree/loading.gif) !important; } .x-tree-node-loading a span{ font-style: italic; color:#444444; } .ext-ie .x-tree-node-el input { width:15px; height:15px; } /* Line styles */ .x-tree-lines .x-tree-elbow{ background-image:url(../images/default/tree/elbow.gif); } .x-tree-lines .x-tree-elbow-plus{ background-image:url(../images/default/tree/elbow-plus.gif); } .x-tree-lines .x-tree-elbow-minus{ background-image:url(../images/default/tree/elbow-minus.gif); } .x-tree-lines .x-tree-elbow-end{ background-image:url(../images/default/tree/elbow-end.gif); } .x-tree-lines .x-tree-elbow-end-plus{ background-image:url(../images/default/tree/elbow-end-plus.gif); } .x-tree-lines .x-tree-elbow-end-minus{ background-image:url(../images/default/tree/elbow-end-minus.gif); } .x-tree-lines .x-tree-elbow-line{ background-image:url(../images/default/tree/elbow-line.gif); } /* No line styles */ .x-tree-no-lines .x-tree-elbow{ background:transparent; } .x-tree-no-lines .x-tree-elbow-plus{ background-image:url(../images/default/tree/elbow-plus-nl.gif); } .x-tree-no-lines .x-tree-elbow-minus{ background-image:url(../images/default/tree/elbow-minus-nl.gif); } .x-tree-no-lines .x-tree-elbow-end{ background:transparent; } .x-tree-no-lines .x-tree-elbow-end-plus{ background-image:url(../images/default/tree/elbow-end-plus-nl.gif); } .x-tree-no-lines .x-tree-elbow-end-minus{ background-image:url(../images/default/tree/elbow-end-minus-nl.gif); } .x-tree-no-lines .x-tree-elbow-line{ background:transparent; } /* Arrows */ .x-tree-arrows .x-tree-elbow{ background:transparent; } .x-tree-arrows .x-tree-elbow-plus{ background:transparent url(../images/default/tree/arrows.gif) no-repeat 0 0; } .x-tree-arrows .x-tree-elbow-minus{ background:transparent url(../images/default/tree/arrows.gif) no-repeat -16px 0; } .x-tree-arrows .x-tree-elbow-end{ background:transparent; } .x-tree-arrows .x-tree-elbow-end-plus{ background:transparent url(../images/default/tree/arrows.gif) no-repeat 0 0; } .x-tree-arrows .x-tree-elbow-end-minus{ background:transparent url(../images/default/tree/arrows.gif) no-repeat -16px 0; } .x-tree-arrows .x-tree-elbow-line{ background:transparent; } .x-tree-arrows .x-tree-ec-over .x-tree-elbow-plus{ background-position:-32px 0; } .x-tree-arrows .x-tree-ec-over .x-tree-elbow-minus{ background-position:-48px 0; } .x-tree-arrows .x-tree-ec-over .x-tree-elbow-end-plus{ background-position:-32px 0; } .x-tree-arrows .x-tree-ec-over .x-tree-elbow-end-minus{ background-position:-48px 0; } .x-tree-elbow-plus, .x-tree-elbow-minus, .x-tree-elbow-end-plus, .x-tree-elbow-end-minus{ cursor:pointer; } .ext-ie ul.x-tree-node-ct{ font-size:0; line-height:0; zoom:1; } .x-tree-node{ color: black; font: normal 11px arial, tahoma, helvetica, sans-serif; white-space: nowrap; } .x-tree-node-el { line-height:18px; cursor:pointer; } .x-tree-node a, .x-dd-drag-ghost a{ text-decoration:none; color:black; -khtml-user-select:none; -moz-user-select:none; -kthml-user-focus:normal; -moz-user-focus:normal; -moz-outline: 0 none; outline:0 none; } .x-tree-node a span, .x-dd-drag-ghost a span{ text-decoration:none; color:black; padding:1px 3px 1px 2px; } .x-tree-node .x-tree-node-disabled a span{ color:gray !important; } .x-tree-node .x-tree-node-disabled .x-tree-node-icon{ -moz-opacity: 0.5; opacity:.5; filter: alpha(opacity=50); } .x-tree-node .x-tree-node-inline-icon{ background:transparent; } .x-tree-node a:hover, .x-dd-drag-ghost a:hover{ text-decoration:none; } .x-tree-node div.x-tree-drag-insert-below{ border-bottom:1px dotted #3366cc; } .x-tree-node div.x-tree-drag-insert-above{ border-top:1px dotted #3366cc; } .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-below{ border-bottom:0 none; } .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-above{ border-top:0 none; } .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-below a{ border-bottom:2px solid #3366cc; } .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-above a{ border-top:2px solid #3366cc; } .x-tree-node .x-tree-drag-append a span{ background:#dddddd; border:1px dotted gray; } .x-tree-node .x-tree-node-over { background-color: #eee; } .x-tree-node .x-tree-selected { background-color: #d9e8fb; } .x-dd-drag-ghost .x-tree-node-indent, .x-dd-drag-ghost .x-tree-ec-icon{ display:none !important; } .x-tree-drop-ok-append .x-dd-drop-icon{ background-image: url(../images/default/tree/drop-add.gif); } .x-tree-drop-ok-above .x-dd-drop-icon{ background-image: url(../images/default/tree/drop-over.gif); } .x-tree-drop-ok-below .x-dd-drop-icon{ background-image: url(../images/default/tree/drop-under.gif); } .x-tree-drop-ok-between .x-dd-drop-icon{ background-image: url(../images/default/tree/drop-between.gif); }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/tree.css
CSS
mit
6,782
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* Grid3 styles */ .x-grid3 { position:relative; overflow:hidden; background-color:#fff; } .x-grid-panel .x-panel-body { overflow:hidden !important; } .x-grid-panel .x-panel-mc .x-panel-body { border:1px solid #99bbe8; } .ext-ie .x-grid3 table,.ext-safari .x-grid3 table { table-layout:fixed; } .x-grid3-viewport{ overflow:hidden; } .x-grid3-hd-row td, .x-grid3-row td, .x-grid3-summary-row td{ font:normal 11px arial, tahoma, helvetica, sans-serif; -moz-outline: none; -moz-user-focus: normal; } .x-grid3-row td, .x-grid3-summary-row td { line-height:13px; vertical-align: top; padding-left:1px; padding-right:1px; -moz-user-select: none; } .x-grid3-hd-row td { line-height:15px; vertical-align:middle; border-left:1px solid #eee; border-right:1px solid #d0d0d0; } .x-grid3-hd-row .x-grid3-marker-hd { padding:3px; } .x-grid3-row .x-grid3-marker { padding:3px; } .x-grid3-cell-inner, .x-grid3-hd-inner{ overflow:hidden; -o-text-overflow: ellipsis; text-overflow: ellipsis; padding:3px 3px 3px 5px; white-space: nowrap; } .x-grid3-hd-inner { position:relative; cursor:inherit; padding:4px 3px 4px 5px; } .x-grid3-row-body { white-space:normal; } .x-grid3-body-cell { -moz-outline:0 none; outline:0 none; } /* IE Quirks to clip */ .ext-ie .x-grid3-cell-inner, .ext-ie .x-grid3-hd-inner{ width:100%; } /* reverse above in strict mode */ .ext-strict .x-grid3-cell-inner, .ext-strict .x-grid3-hd-inner{ width:auto; } .x-grid3-col { } .x-grid-row-loading { background: #fff url(../images/default/shared/loading-balls.gif) no-repeat center center; } .x-grid-page { overflow:hidden; } .x-grid3-row { cursor: default; border:1px solid #ededed; border-top-color:#fff; /*border-bottom: 1px solid #ededed;*/ width:100%; } .x-grid3-row-alt{ background-color:#fafafa; } .x-grid3-row-over { border:1px solid #dddddd; background: #efefef url(../images/default/grid/row-over.gif) repeat-x left top; } .x-grid3-resize-proxy { width:1px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; visibility:hidden; border:0 none; z-index:7; } .x-grid3-resize-marker { width:1px; left:0; background-color:#777; position:absolute; top:0; height:100px; overflow:hidden; visibility:hidden; border:0 none; z-index:7; } .x-grid3-focus { position:absolute; top:0; -moz-outline:0 none; outline:0 none; -moz-user-select: normal; -khtml-user-select: normal; } /* header styles */ .x-grid3-header{ background: #f9f9f9 url(../images/default/grid/grid3-hrow.gif) repeat-x 0 bottom; cursor:default; zoom:1; padding:1px 0 0 0; } .x-grid3-header-pop { border-left:1px solid #d0d0d0; float:right; clear:none; } .x-grid3-header-pop-inner { border-left:1px solid #eee; width:14px; height:19px; background: transparent url(../images/default/grid/hd-pop.gif) no-repeat center center; } .ext-ie .x-grid3-header-pop-inner { width:15px; } .ext-strict .x-grid3-header-pop-inner { width:14px; } .x-grid3-header-inner { overflow:hidden; zoom:1; float:left; } .x-grid3-header-offset { padding-left:1px; width:10000px; } td.x-grid3-hd-over, td.sort-desc, td.sort-asc, td.x-grid3-hd-menu-open { border-left:1px solid #aaccf6; border-right:1px solid #aaccf6; } td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-asc .x-grid3-hd-inner, td.x-grid3-hd-menu-open .x-grid3-hd-inner { background: #ebf3fd url(../images/default/grid/grid3-hrow-over.gif) repeat-x left bottom; } .x-grid3-sort-icon{ background-repeat: no-repeat; display: none; height: 4px; width: 13px; margin-left:3px; vertical-align: middle; } .sort-asc .x-grid3-sort-icon { background-image: url(../images/default/grid/sort_asc.gif); display: inline; } .sort-desc .x-grid3-sort-icon { background-image: url(../images/default/grid/sort_desc.gif); display: inline; } /* Header position fixes for IE strict mode */ .ext-strict .ext-ie .x-grid3-header-inner{position:relative;} .ext-strict .ext-ie6 .x-grid3-hd{position:relative;} .ext-strict .ext-ie6 .x-grid3-hd-inner{position:static;} /* Body Styles */ .x-grid3-body { zoom:1; } .x-grid3-scroller { overflow:auto; zoom:1; position:relative; } .x-grid3-cell-text, .x-grid3-hd-text { display: block; padding: 3px 5px 3px 5px; -moz-user-select: none; -khtml-user-select: none; color:black; } .x-grid3-split { background-image: url(../images/default/grid/grid-split.gif); background-position: center; background-repeat: no-repeat; cursor: e-resize; cursor: col-resize; display: block; font-size: 1px; height: 16px; overflow: hidden; position: absolute; top: 2px; width: 6px; z-index: 3; } .x-grid3-hd-text { color:#15428b; } /* Column Reorder DD */ .x-dd-drag-proxy .x-grid3-hd-inner{ background: #ebf3fd url(../images/default/grid/grid3-hrow-over.gif) repeat-x left bottom; width:120px; padding:3px; border:1px solid #aaccf6; overflow:hidden; } .col-move-top, .col-move-bottom{ width:9px; height:9px; position:absolute; top:0; line-height:1px; font-size:1px; overflow:hidden; visibility:hidden; z-index:20000; } .col-move-top{ background:transparent url(../images/default/grid/col-move-top.gif) no-repeat left top; } .col-move-bottom{ background:transparent url(../images/default/grid/col-move-bottom.gif) no-repeat left top; } /* Selection Styles */ .x-grid3-row-selected { background: #DFE8F6 !important; border:1px dotted #a3bae9; } .x-grid3-cell-selected{ background-color: #B8CFEE !important; color: black; } .x-grid3-cell-selected span{ color: black !important; } .x-grid3-cell-selected .x-grid3-cell-text{ color: black; } .x-grid3-locked td.x-grid3-row-marker, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{ background: #ebeadb url(../images/default/grid/grid-hrow.gif) repeat-x 0 bottom !important; vertical-align:middle !important; color:black; padding:0; border-top:1px solid white; border-bottom:none !important; border-right:1px solid #6fa0df !important; text-align:center; } .x-grid3-locked td.x-grid3-row-marker div, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{ padding:0 4px; color:#15428b !important; text-align:center; } /* dirty cells */ .x-grid3-dirty-cell { background: transparent url(../images/default/grid/dirty.gif) no-repeat 0 0; } /* Grid Toolbars */ .x-grid3-topbar, .x-grid3-bottombar{ font:normal 11px arial, tahoma, helvetica, sans-serif; overflow:hidden; display:none; zoom:1; position:relative; } .x-grid3-topbar .x-toolbar{ border-right:0 none; } .x-grid3-bottombar .x-toolbar{ border-right:0 none; border-bottom:0 none; border-top:1px solid #a9bfd3; } /* Props Grid Styles */ .x-props-grid .x-grid3-cell{ padding:1px; } .x-props-grid .x-grid3-td-name .x-grid3-cell-inner{ background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y -16px !important; padding-left:12px; color:black !important; } .x-props-grid .x-grid3-body .x-grid3-td-name{ padding:1px; padding-right:0; background:white !important; border:0 none; border-right:1px solid #eeeeee; } /* header menu */ .xg-hmenu-sort-asc .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-asc.gif); } .xg-hmenu-sort-desc .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-desc.gif); } .xg-hmenu-lock .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-lock.gif); } .xg-hmenu-unlock .x-menu-item-icon{ background-image: url(../images/default/grid/hmenu-unlock.gif); } /* dd */ .x-grid3-col-dd { border:0 none; padding:0; background:transparent; } .x-dd-drag-ghost .x-grid3-dd-wrap { padding:1px 3px 3px 1px; } .x-grid3-hd { -moz-user-select:none; } .x-grid3-hd-btn { display:none; position:absolute; width:14px; background:#c3daf9 url(../images/default/grid/grid3-hd-btn.gif) no-repeat left center; right:0; top:0; z-index:2; cursor:pointer; } .x-grid3-hd-over .x-grid3-hd-btn, .x-grid3-hd-menu-open .x-grid3-hd-btn { display:block; } a.x-grid3-hd-btn:hover { background-position:-14px center; } /* Expanders */ .x-grid3-body .x-grid3-td-expander { background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right; } .x-grid3-body .x-grid3-td-expander .x-grid3-cell-inner { padding:0 !important; height:100%; } .x-grid3-row-expander { width:100%; height:18px; background-position:4px 2px; background-repeat:no-repeat; background-color:transparent; background-image:url(../images/default/grid/row-expand-sprite.gif); } .x-grid3-row-collapsed .x-grid3-row-expander { background-position:4px 2px; } .x-grid3-row-expanded .x-grid3-row-expander { background-position:-21px 2px; } .x-grid3-row-collapsed .x-grid3-row-body { display:none !important; } .x-grid3-row-expanded .x-grid3-row-body { display:block !important; } /* Checkers */ .x-grid3-body .x-grid3-td-checker { background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right; } .x-grid3-body .x-grid3-td-checker .x-grid3-cell-inner, .x-grid3-header .x-grid3-td-checker .x-grid3-hd-inner { padding:0 !important; height:100%; } .x-grid3-row-checker, .x-grid3-hd-checker { width:100%; height:18px; background-position:2px 2px; background-repeat:no-repeat; background-color:transparent; background-image:url(../images/default/grid/row-check-sprite.gif); } .x-grid3-row .x-grid3-row-checker { background-position:2px 2px; } .x-grid3-row-selected .x-grid3-row-checker, .x-grid3-hd-checker-on .x-grid3-hd-checker { background-position:-23px 2px; } .x-grid3-hd-checker { background-position:2px 3px; } .x-grid3-hd-checker-on .x-grid3-hd-checker { background-position:-23px 3px; } /* Numberer */ .x-grid3-body .x-grid3-td-numberer { background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right; } .x-grid3-body .x-grid3-td-numberer .x-grid3-cell-inner { padding:3px 5px 0 0 !important; text-align:right; color:#444; } /* All specials */ .x-grid3-body .x-grid3-row-selected .x-grid3-td-numberer, .x-grid3-body .x-grid3-row-selected .x-grid3-td-checker, .x-grid3-body .x-grid3-row-selected .x-grid3-td-expander { background:transparent url(../images/default/grid/grid3-special-col-sel-bg.gif) repeat-y right; } .x-grid3-body .x-grid3-check-col-td .x-grid3-cell-inner { padding: 1px 0 0 0 !important; } .x-grid3-check-col { width:100%; height:16px; background-position:center center; background-repeat:no-repeat; background-color:transparent; background-image:url(../images/default/menu/unchecked.gif); } .x-grid3-check-col-on { width:100%; height:16px; background-position:center center; background-repeat:no-repeat; background-color:transparent; background-image:url(../images/default/menu/checked.gif); } /* Grouping classes */ .x-grid-group, .x-grid-group-body, .x-grid-group-hd { zoom:1; } .x-grid-group-hd { border-bottom: 2px solid #99bbe8; cursor:pointer; padding-top:6px; } .x-grid-group-hd div { background:transparent url(../images/default/grid/group-expand-sprite.gif) no-repeat 3px -47px; padding:4px 4px 4px 17px; color:#3764a0; font:bold 11px tahoma, arial, helvetica, sans-serif; } .x-grid-group-collapsed .x-grid-group-hd div { background-position: 3px 3px; } .x-grid-group-collapsed .x-grid-group-body { display:none; } .x-group-by-icon { background-image:url(../images/default/grid/group-by.gif); } .x-cols-icon { background-image:url(../images/default/grid/columns.gif); } .x-show-groups-icon { background-image:url(../images/default/grid/group-by.gif); } .ext-ie .x-grid3 .x-editor .x-form-text { position:relative; top:-1px; } .ext-ie .x-props-grid .x-editor .x-form-text { position:static; top:0; } .x-grid-empty { padding:10px; color:gray; font:normal 11px tahoma, arial, helvetica, sans-serif; } /* fix floating toolbar issue */ .ext-ie7 .x-grid-panel .x-panel-bbar { position:relative; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/grid.css
CSS
mit
13,034
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ #x-debug-browser .x-tree .x-tree-node a span { color:#222297; font-size:11px; padding-top:2px; font-family:"monotype","courier new",sans-serif; line-height:18px; } #x-debug-browser .x-tree a i { color:#FF4545; font-style:normal; } #x-debug-browser .x-tree a em { color:#999; } #x-debug-browser .x-tree .x-tree-node .x-tree-selected a span{ background:#c3daf9; } #x-debug-browser .x-tool-toggle { background-position:0 -75px; } #x-debug-browser .x-tool-toggle-over { background-position:-15px -75px; } #x-debug-browser.x-panel-collapsed .x-tool-toggle { background-position:0 -60px; } #x-debug-browser.x-panel-collapsed .x-tool-toggle-over { background-position:-15px -60px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/debug.css
CSS
mit
892
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;} img,body,html{border:0;} address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;} ol,ul{list-style:none;} caption,th{text-align:left;} h1,h2,h3,h4,h5,h6{font-size:100%;} q:before,q:after{content:'';} .ext-el-mask{z-index:20000;position:absolute;top:0;left:0;-moz-opacity:0.5;opacity:.50;filter:alpha(opacity=50);background-color:#CCC;width:100%;height:100%;zoom:1;} .ext-el-mask-msg{z-index:20001;position:absolute;top:0;left:0;border:1px solid #6593cf;background:#c3daf9 url(../images/default/box/tb-blue.gif) repeat-x 0 -16px;padding:2px;} .ext-el-mask-msg div{padding:5px 10px 5px 10px;background:#eee;border:1px solid #a3bad9;color:#222;font:normal 11px tahoma,arial,helvetica,sans-serif;cursor:wait;} .ext-shim{position:absolute;visibility:hidden;left:0;top:0;overflow:hidden;} .ext-ie .ext-shim{filter:alpha(opacity=0);} .ext-ie6 .ext-shim{margin-left:5px;margin-top:3px;} .x-mask-loading div{padding:5px 10px 5px 25px;background:#fbfbfb url( '../images/default/grid/loading.gif' ) no-repeat 5px 5px;line-height:16px;} .x-hidden,.x-hide-offsets{position:absolute;left:-10000px;top:-10000px;visibility:hidden;} .x-hide-display{display:none!important;} .x-hide-visibility{visibility:hidden!important;} .x-masked{overflow:hidden!important;} .x-masked select,.x-masked object,.x-masked embed{visibility:hidden;} .x-layer{visibility:hidden;} .x-unselectable,.x-unselectable *{-moz-user-select:none;-khtml-user-select:none;} .x-repaint{zoom:1;background-color:transparent;-moz-outline:none;} .x-item-disabled{color:gray;cursor:default;opacity:.6;-moz-opacity:.6;filter:alpha(opacity=60);} .x-item-disabled *{color:gray!important;cursor:default!important;} .x-splitbar-proxy{position:absolute;visibility:hidden;z-index:20001;background:#aaa;zoom:1;line-height:1px;font-size:1px;overflow:hidden;} .x-splitbar-h,.x-splitbar-proxy-h{cursor:e-resize;cursor:col-resize;} .x-splitbar-v,.x-splitbar-proxy-v{cursor:s-resize;cursor:row-resize;} .x-color-palette{width:150px;height:92px;cursor:pointer;} .x-color-palette a{border:1px solid #fff;float:left;padding:2px;text-decoration:none;-moz-outline:0 none;outline:0 none;cursor:pointer;} .x-color-palette a:hover,.x-color-palette a.x-color-palette-sel{border:1px solid #8BB8F3;background:#deecfd;} .x-color-palette em{display:block;border:1px solid #ACA899;} .x-color-palette em span{cursor:pointer;display:block;height:10px;line-height:10px;width:10px;} .x-ie-shadow{display:none;position:absolute;overflow:hidden;left:0;top:0;background:#777;zoom:1;} .x-shadow{display:none;position:absolute;overflow:hidden;left:0;top:0;} .x-shadow *{overflow:hidden;} .x-shadow *{padding:0;border:0;margin:0;clear:none;zoom:1;} .x-shadow .xstc,.x-shadow .xsbc{height:6px;float:left;} .x-shadow .xstl,.x-shadow .xstr,.x-shadow .xsbl,.x-shadow .xsbr{width:6px;height:6px;float:left;} .x-shadow .xsc{width:100%;} .x-shadow .xsml,.x-shadow .xsmr{width:6px;float:left;height:100%;} .x-shadow .xsmc{float:left;height:100%;background:transparent url( ../images/default/shadow-c.png );} .x-shadow .xst,.x-shadow .xsb{height:6px;overflow:hidden;width:100%;} .x-shadow .xsml{background:transparent url( ../images/default/shadow-lr.png ) repeat-y 0 0;} .x-shadow .xsmr{background:transparent url( ../images/default/shadow-lr.png ) repeat-y -6px 0;} .x-shadow .xstl{background:transparent url( ../images/default/shadow.png ) no-repeat 0 0;} .x-shadow .xstc{background:transparent url( ../images/default/shadow.png ) repeat-x 0 -30px;} .x-shadow .xstr{background:transparent url( ../images/default/shadow.png ) repeat-x 0 -18px;} .x-shadow .xsbl{background:transparent url( ../images/default/shadow.png ) no-repeat 0 -12px;} .x-shadow .xsbc{background:transparent url( ../images/default/shadow.png ) repeat-x 0 -36px;} .x-shadow .xsbr{background:transparent url( ../images/default/shadow.png ) repeat-x 0 -6px;} .loading-indicator{font-size:11px;background-image:url(../images/default/grid/loading.gif);background-repeat:no-repeat;background-position:left;padding-left:20px;line-height:16px;margin:3px;} .x-text-resize{position:absolute;left:-1000px;top:-1000px;visibility:hidden;zoom:1;} .x-drag-overlay{width:100%;height:100%;display:none;position:absolute;left:0;top:0;background-image:url(../images/default/s.gif);z-index:20000;} .x-clear{clear:both;height:0;overflow:hidden;line-height:0;font-size:0;} .x-spotlight{z-index:8999;position:absolute;top:0;left:0;-moz-opacity:0.5;opacity:.50;filter:alpha(opacity=50);background-color:#CCC;width:0;height:0;zoom:1;} .x-tab-panel{overflow:hidden;} .x-tab-panel-header,.x-tab-panel-footer{background:#deecfd;border:1px solid #8db2e3;overflow:hidden;zoom:1;} .x-tab-panel-header{border:1px solid #8db2e3;padding-bottom:2px;} .x-tab-panel-footer{border:1px solid #8db2e3;padding-top:2px;} .x-tab-strip-wrap{width:100%;overflow:hidden;position:relative;zoom:1;} ul.x-tab-strip{display:block;width:5000px;zoom:1;} ul.x-tab-strip-top{padding-top:1px;background:url(../images/default/tabs/tab-strip-bg.gif) #cedff5 repeat-x bottom;border-bottom:1px solid #8db2e3;} ul.x-tab-strip-bottom{padding-bottom:1px;background:url(../images/default/tabs/tab-strip-btm-bg.gif) #cedff5 repeat-x top;border-top:1px solid #8db2e3;border-bottom:0 none;} .x-tab-panel-header-plain .x-tab-strip-top{background:transparent!important;padding-top:0!important;} .x-tab-panel-header-plain{background:transparent!important;border-width:0!important;padding-bottom:0!important;} .x-tab-panel-header-plain .x-tab-strip-spacer{border:1px solid #8db2e3;border-top:0 none;height:2px;background:#deecfd;font-size:1px;line-height:1px;} .ext-border-box .x-tab-panel-header-plain .x-tab-strip-spacer{height:3px;} ul.x-tab-strip li{float:left;margin-left:2px;} ul.x-tab-strip li.x-tab-edge{float:left;margin:0!important;padding:0!important;border:0 none!important;font-size:1px!important;line-height:1px!important;overflow:hidden;zoom:1;background:transparent!important;width:1px;} .x-tab-strip a,.x-tab-strip span,.x-tab-strip em{display:block;} .x-tab-strip a{text-decoration:none!important;-moz-outline:none;outline:none;cursor:pointer;} .x-tab-strip-inner{overflow:hidden;text-overflow:ellipsis;} .x-tab-strip span.x-tab-strip-text{font:normal 11px tahoma,arial,helvetica;color:#416aa3;white-space:nowrap;cursor:pointer;padding:4px 0;} .x-tab-strip .x-tab-with-icon .x-tab-right{padding-left:6px;} .x-tab-strip .x-tab-with-icon span.x-tab-strip-text{padding-left:20px;background-position:0 3px;background-repeat:no-repeat;} .x-tab-strip-over span.x-tab-strip-text{color:#15428b;} .x-tab-strip-active{cursor:default;} .x-tab-strip-active span.x-tab-strip-text{cursor:default;color:#15428b;font-weight:bold;} .x-tab-strip-disabled .x-tabs-text{cursor:default;color:#aaa;} .x-tab-panel-body{overflow:hidden;} .x-tab-panel-bwrap{overflow:hidden;} .ext-ie .x-tab-strip .x-tab-right{position:relative;} .x-tab-strip-top .x-tab-strip-active .x-tab-right{margin-bottom:-1px;} .x-tab-strip-top .x-tab-strip-active .x-tab-right span.x-tab-strip-text{padding-bottom:5px;} .x-tab-strip-bottom .x-tab-strip-active .x-tab-right{margin-top:-1px;} .x-tab-strip-bottom .x-tab-strip-active .x-tab-right span.x-tab-strip-text{padding-top:5px;} .x-tab-strip-top .x-tab-right{background:transparent url(../images/default/tabs/tabs-sprite.gif) no-repeat 0 -51px;padding-left:10px;} .x-tab-strip-top .x-tab-left{background:transparent url(../images/default/tabs/tabs-sprite.gif) no-repeat right -351px;padding-right:10px;} .x-tab-strip-top .x-tab-strip-inner{background:transparent url(../images/default/tabs/tabs-sprite.gif) repeat-x 0 -201px;} .x-tab-strip-top .x-tab-strip-over .x-tab-right{background-position:0 -101px;} .x-tab-strip-top .x-tab-strip-over .x-tab-left{background-position:right -401px;} .x-tab-strip-top .x-tab-strip-over .x-tab-strip-inner{background-position:0 -251px;} .x-tab-strip-top .x-tab-strip-active .x-tab-right{background-position:0 0;} .x-tab-strip-top .x-tab-strip-active .x-tab-left{background-position:right -301px;} .x-tab-strip-top .x-tab-strip-active .x-tab-strip-inner{background-position:0 -151px;} .x-tab-strip-bottom .x-tab-right{background:url(../images/default/tabs/tab-btm-inactive-right-bg.gif) no-repeat bottom right;} .x-tab-strip-bottom .x-tab-left{background:url(../images/default/tabs/tab-btm-inactive-left-bg.gif) no-repeat bottom left;} .x-tab-strip-bottom .x-tab-strip-active .x-tab-right{background:url(../images/default/tabs/tab-btm-right-bg.gif) no-repeat bottom left;} .x-tab-strip-bottom .x-tab-strip-active .x-tab-left{background:url(../images/default/tabs/tab-btm-left-bg.gif) no-repeat bottom right;} .x-tab-strip-bottom .x-tab-left{padding:0 10px;} .x-tab-strip-bottom .x-tab-right{padding:0;} .x-tab-strip .x-tab-strip-close{display:none;} .x-tab-strip-closable{position:relative;} .x-tab-strip-closable .x-tab-left{padding-right:19px;} .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close{background-image:url(../images/default/tabs/tab-close.gif);opacity:.6;-moz-opacity:.6;background-repeat:no-repeat;display:block;width:11px;height:11px;position:absolute;top:3px;right:3px;cursor:pointer;z-index:2;} .x-tab-strip .x-tab-strip-active a.x-tab-strip-close{opacity:.8;-moz-opacity:.8;} .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close:hover{background-image:url(../images/default/tabs/tab-close.gif);opacity:1;-moz-opacity:1;} .x-tab-panel-body{border:1px solid #8db2e3;background:#fff;} .x-tab-panel-body-top{border-top:0 none;} .x-tab-panel-body-bottom{border-bottom:0 none;} .x-tab-scroller-left{background:transparent url(../images/default/tabs/scroll-left.gif) no-repeat -18px 0;border-bottom:1px solid #8db2e3;width:18px;position:absolute;left:0;top:0;z-index:10;cursor:pointer;} .x-tab-scroller-left-over{background-position:0 0;} .x-tab-scroller-left-disabled{background-position:-18px 0;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);cursor:default;} .x-tab-scroller-right{background:transparent url(../images/default/tabs/scroll-right.gif) no-repeat 0 0;border-bottom:1px solid #8db2e3;width:18px;position:absolute;right:0;top:0;z-index:10;cursor:pointer;} .x-tab-scroller-right-over{background-position:-18px 0;} .x-tab-scroller-right-disabled{background-position:0 0;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);cursor:default;} .x-tab-scrolling .x-tab-strip-wrap{margin-left:18px;margin-right:18px;} .x-tab-scrolling{position:relative;} .x-tab-panel-bbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-tab-panel-tbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-border-layout-ct .x-tab-panel{background:white;} .x-form-field{margin:0;font:normal 12px tahoma,arial,helvetica,sans-serif;} .x-form-text,textarea.x-form-field{padding:1px 3px;background:#fff url(../images/default/form/text-bg.gif) repeat-x 0 0;border:1px solid #B5B8C8;} textarea.x-form-field{padding:2px 3px;} .x-form-text{height:22px;line-height:18px;vertical-align:middle;} .ext-ie .x-form-text{margin:-1px 0;height:22px;line-height:18px;} .ext-ie textarea.x-form-field{margin:-1px 0;} .ext-strict .x-form-text{height:18px;} .ext-safari .x-form-text{height:20px;padding:0 3px;} .ext-safari.ext-mac textarea.x-form-field{margin-bottom:-2px;} .ext-gecko .x-form-text{padding-top:2px;padding-bottom:0;} textarea{resize:none;} .x-form-select-one{height:20px;line-height:18px;vertical-align:middle;background-color:#fff;border:1px solid #B5B8C8;} .x-form-field-wrap{position:relative;zoom:1;white-space:nowrap;} .x-editor .x-form-check-wrap{background:#fff;} .x-form-field-wrap .x-form-trigger{width:17px;height:21px;border:0;background:transparent url(../images/default/form/trigger.gif) no-repeat 0 0;cursor:pointer;border-bottom:1px solid #B5B8C8;position:absolute;top:0;} .ext-safari .x-form-field-wrap .x-form-trigger{height:21px;} .x-form-field-wrap .x-form-date-trigger{background-image:url(../images/default/form/date-trigger.gif);cursor:pointer;} .x-form-field-wrap .x-form-clear-trigger{background-image:url(../images/default/form/clear-trigger.gif);cursor:pointer;} .x-form-field-wrap .x-form-search-trigger{background-image:url(../images/default/form/search-trigger.gif);cursor:pointer;} .ext-safari .x-form-field-wrap .x-form-trigger{right:0;} .x-form-field-wrap .x-form-twin-triggers .x-form-trigger{position:static;top:auto;vertical-align:top;} .x-form-field-wrap .x-form-trigger-over{background-position:-17px 0;} .x-form-field-wrap .x-form-trigger-click{background-position:-34px 0;} .x-trigger-wrap-focus .x-form-trigger{background-position:-51px 0;} .x-trigger-wrap-focus .x-form-trigger-over{background-position:-68px 0;} .x-trigger-wrap-focus .x-form-trigger-click{background-position:-85px 0;} .x-trigger-wrap-focus .x-form-trigger{border-bottom:1px solid #7eadd9;} .x-item-disabled .x-form-trigger-over{background-position:0 0!important;border-bottom:1px solid #B5B8C8;} .x-item-disabled .x-form-trigger-click{background-position:0 0!important;border-bottom:1px solid #B5B8C8;} .x-form-focus,textarea.x-form-focus{border:1px solid #7eadd9;} .x-form-invalid,textarea.x-form-invalid{background:#fff url(../images/default/grid/invalid_line.gif) repeat-x bottom;border:1px solid #dd7870;} .ext-safari .x-form-invalid{background-color:#fee;border:1px solid #ff7870;} .x-editor{visibility:hidden;padding:0;margin:0;} .x-form-check-wrap{line-height:18px;} .ext-ie .x-form-check-wrap input{width:15px;height:15px;} .x-editor .x-form-check-wrap{padding:3px;} .x-editor .x-form-checkbox{height:13px;} .x-form-grow-sizer{font:normal 12px tahoma,arial,helvetica,sans-serif;left:-10000px;padding:8px 3px;position:absolute;visibility:hidden;top:-10000px;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;zoom:1;} .x-form-grow-sizer p{margin:0!important;border:0 none!important;padding:0!important;} .x-form-item{font:normal 12px tahoma,arial,helvetica,sans-serif;display:block;margin-bottom:4px;} .x-form-item label{display:block;float:left;width:100px;padding:3px;padding-left:0;clear:left;z-index:2;position:relative;} .x-form-element{padding-left:105px;position:relative;} .x-form-invalid-msg{color:#e00;padding:2px;padding-left:18px;font:normal 11px tahoma,arial,helvetica,sans-serif;background:transparent url(../images/default/shared/warning.gif) no-repeat 0 2px;line-height:16px;width:200px;} .x-form-label-right label{text-align:right;} .x-form-label-top .x-form-item label{width:auto;float:none;clear:none;display:inline;margin-bottom:4px;position:static;} .x-form-label-top .x-form-element{padding-left:0;padding-top:4px;} .x-form-label-top .x-form-item{padding-bottom:4px;} .x-form-empty-field{color:gray;} .x-small-editor .x-form-field{font:normal 11px arial,tahoma,helvetica,sans-serif;} .x-small-editor .x-form-text{height:20px;line-height:16px;vertical-align:middle;} .ext-ie .x-small-editor .x-form-text{margin-top:-1px!important;margin-bottom:-1px!important;height:20px!important;line-height:16px!important;} .ext-strict .x-small-editor .x-form-text{height:16px!important;} .ext-safari .x-small-editor .x-form-field{font:normal 12px arial,tahoma,helvetica,sans-serif;} .ext-ie .x-small-editor .x-form-text{height:20px;line-height:16px;} .ext-border-box .x-small-editor .x-form-text{height:20px;} .x-small-editor .x-form-select-one{height:20px;line-height:16px;vertical-align:middle;} .x-small-editor .x-form-num-field{text-align:right;} .x-small-editor .x-form-field-wrap .x-form-trigger{height:19px;} .x-form-clear{clear:both;height:0;overflow:hidden;line-height:0;font-size:0;} .x-form-clear-left{clear:left;height:0;overflow:hidden;line-height:0;font-size:0;} .x-form-cb-label{width:'auto'!important;float:none!important;clear:none!important;display:inline!important;margin-left:4px;} .x-form-column{float:left;padding:0;margin:0;width:48%;overflow:hidden;zoom:1;} .x-form .x-form-btns-ct .x-btn{float:right;clear:none;} .x-form .x-form-btns-ct .x-form-btns td{border:0;padding:0;} .x-form .x-form-btns-ct .x-form-btns-right table{float:right;clear:none;} .x-form .x-form-btns-ct .x-form-btns-left table{float:left;clear:none;} .x-form .x-form-btns-ct .x-form-btns-center{text-align:center;} .x-form .x-form-btns-ct .x-form-btns-center table{margin:0 auto;} .x-form .x-form-btns-ct table td.x-form-btn-td{padding:3px;} .x-form .x-form-btns-ct .x-btn-focus .x-btn-left{background-position:0 -147px;} .x-form .x-form-btns-ct .x-btn-focus .x-btn-right{background-position:0 -168px;} .x-form .x-form-btns-ct .x-btn-focus .x-btn-center{background-position:0 -189px;} .x-form .x-form-btns-ct .x-btn-click .x-btn-center{background-position:0 -126px;} .x-form .x-form-btns-ct .x-btn-click .x-btn-right{background-position:0 -84px;} .x-form .x-form-btns-ct .x-btn-click .x-btn-left{background-position:0 -63px;} .x-form-invalid-icon{width:16px;height:18px;visibility:hidden;position:absolute;left:0;top:0;display:block;background:transparent url(../images/default/form/exclamation.gif) no-repeat 0 2px;} .x-fieldset{border:1px solid #B5B8C8;padding:10px;margin-bottom:10px;} .x-fieldset legend{font:bold 11px tahoma,arial,helvetica,sans-serif;color:#15428b;} .ext-ie .x-fieldset legend{margin-bottom:10px;} .ext-ie .x-fieldset{padding-top:0;padding-bottom:10px;} .x-fieldset legend .x-tool-toggle{margin-right:3px;margin-left:0;float:left!important;} .x-fieldset legend input{margin-right:3px;float:left!important;height:13px;width:13px;} fieldset.x-panel-collapsed{padding-bottom:0!important;border-width:1px 0 0 0!important;} fieldset.x-panel-collapsed .x-fieldset-bwrap{visibility:hidden;position:absolute;left:-1000px;top:-1000px;} .ext-ie .x-fieldset-bwrap{zoom:1;} .ext-ie td .x-form-text{position:relative;top:-1px;} .x-fieldset-noborder{border:0 none transparent;} .x-fieldset-noborder legend{margin-left:-3px;} .ext-ie .x-fieldset-noborder legend{position:relative;margin-bottom:23px;} .ext-ie .x-fieldset-noborder legend span{position:absolute;left:-5px;} .ext-gecko .x-window-body .x-form-item{-moz-outline:none;overflow:auto;} .ext-gecko .x-form-item{-moz-outline:none;} .x-hide-label label.x-form-item-label{display:none;} .x-hide-label .x-form-element{padding-left:0!important;} .x-fieldset{overflow:hidden;} .x-fieldset-bwrap{overflow:hidden;zoom:1;} .x-fieldset-body{overflow:hidden;} .x-btn{font:normal 11px tahoma,verdana,helvetica;cursor:pointer;white-space:nowrap;} .x-btn button{border:0 none;background:transparent;font:normal 11px tahoma,verdana,helvetica;padding-left:3px;padding-right:3px;cursor:pointer;margin:0;overflow:visible;width:auto;-moz-outline:0 none;outline:0 none;} * html .ext-ie .x-btn button{width:1px;} .ext-gecko .x-btn button{padding-left:0;padding-right:0;} .ext-ie .x-btn button{padding-top:2px;} .x-btn-icon .x-btn-center .x-btn-text{background-position:center;background-repeat:no-repeat;height:16px;width:16px;cursor:pointer;white-space:nowrap;padding:0;} .x-btn-icon .x-btn-center{padding:1px;} .x-btn em{font-style:normal;font-weight:normal;} .x-btn-text-icon .x-btn-center .x-btn-text{background-position:0 2px;background-repeat:no-repeat;padding-left:18px;padding-top:3px;padding-bottom:2px;padding-right:0;} .x-btn-left,.x-btn-right{font-size:1px;line-height:1px;} .x-btn-left{width:3px;height:21px;background:url(../images/default/button/btn-sprite.gif) no-repeat 0 0;} .x-btn-right{width:3px;height:21px;background:url(../images/default/button/btn-sprite.gif) no-repeat 0 -21px;} .x-btn-left i,.x-btn-right i{display:block;width:3px;overflow:hidden;font-size:1px;line-height:1px;} .x-btn-center{background:url(../images/default/button/btn-sprite.gif) repeat-x 0 -42px;vertical-align:middle;text-align:center;padding:0 5px;cursor:pointer;white-space:nowrap;} .x-btn-over .x-btn-left{background-position:0 -63px;} .x-btn-over .x-btn-right{background-position:0 -84px;} .x-btn-over .x-btn-center{background-position:0 -105px;} .x-btn-click .x-btn-center,.x-btn-menu-active .x-btn-center{background-position:0 -126px;} .x-btn-disabled *{color:gray!important;cursor:default!important;} .x-btn-menu-text-wrap .x-btn-center{padding:0 3px;} .ext-gecko .x-btn-menu-text-wrap .x-btn-center{padding:0 1px;} .x-btn-menu-arrow-wrap .x-btn-center{padding:0;} .x-btn-menu-arrow-wrap .x-btn-center button{width:12px!important;height:21px;padding:0!important;display:block;background:transparent url(../images/default/button/btn-arrow.gif) no-repeat left 3px;} .x-btn-with-menu .x-btn-center{padding-right:2px!important;} .x-btn-with-menu .x-btn-center em{display:block;background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat right 0;padding-right:10px;} .x-btn-text-icon .x-btn-with-menu .x-btn-center em{display:block;background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat right 3px;padding-right:10px;} .x-btn-pressed .x-btn-left{background:url(../images/default/button/btn-sprite.gif) no-repeat 0 -63px;} .x-btn-pressed .x-btn-right{background:url(../images/default/button/btn-sprite.gif) no-repeat 0 -84px;} .x-btn-pressed .x-btn-center{background:url(../images/default/button/btn-sprite.gif) repeat-x 0 -126px;} .x-toolbar{border-color:#a9bfd3;border-style:solid;border-width:0 0 1px 0;display:block;padding:2px;background:#d0def0 url(../images/default/toolbar/bg.gif) repeat-x top left;position:relative;zoom:1;} .x-toolbar .x-item-disabled .x-btn-icon{opacity:.35;-moz-opacity:.35;filter:alpha(opacity=35);} .x-toolbar td{vertical-align:middle;} .mso .x-toolbar,.x-grid-mso .x-toolbar{border:0 none;background:url(../images/default/grid/mso-hd.gif);} .x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{white-space:nowrap;font:normal 11px tahoma,arial,helvetica,sans-serif;} .x-toolbar .x-item-disabled{color:gray;cursor:default;opacity:.6;-moz-opacity:.6;filter:alpha(opacity=60);} .x-toolbar .x-item-disabled *{color:gray;cursor:default;} .x-toolbar .x-btn-left{background:none;} .x-toolbar .x-btn-right{background:none;} .x-toolbar .x-btn-center{background:none;padding:0;} .x-toolbar .x-btn-menu-text-wrap .x-btn-center button{padding-right:2px;} .ext-gecko .x-toolbar .x-btn-menu-text-wrap .x-btn-center button{padding-right:0;} .x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button{padding:0 2px;} .x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button{width:12px;background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat 0 3px;} .x-toolbar .x-btn-text-icon .x-btn-menu-arrow-wrap .x-btn-center button{width:12px;background:transparent url(../images/default/toolbar/btn-arrow.gif) no-repeat 0 3px;} .x-toolbar .x-btn-over .x-btn-menu-arrow-wrap .x-btn-center button{background-position:0 -47px;} .x-toolbar .x-btn-over .x-btn-left{background:url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 0;} .x-toolbar .x-btn-over .x-btn-right{background:url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -21px;} .x-toolbar .x-btn-over .x-btn-center{background:url(../images/default/toolbar/tb-btn-sprite.gif) repeat-x 0 -42px;} .x-toolbar .x-btn-click .x-btn-left,.x-toolbar .x-btn-pressed .x-btn-left,.x-toolbar .x-btn-menu-active .x-btn-left{background:url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -63px;} .x-toolbar .x-btn-click .x-btn-right,.x-toolbar .x-btn-pressed .x-btn-right,.x-toolbar .x-btn-menu-active .x-btn-right{background:url(../images/default/toolbar/tb-btn-sprite.gif) no-repeat 0 -84px;} .x-toolbar .x-btn-click .x-btn-center,.x-toolbar .x-btn-pressed .x-btn-center,.x-toolbar .x-btn-menu-active .x-btn-center{background:url(../images/default/toolbar/tb-btn-sprite.gif) repeat-x 0 -105px;} .x-toolbar .x-btn-with-menu .x-btn-center em{padding-right:8px;} .x-toolbar .ytb-text{padding:2px;} .x-toolbar .ytb-sep{background-image:url(../images/default/grid/grid-blue-split.gif);background-position:center;background-repeat:no-repeat;display:block;font-size:1px;height:16px;width:4px;overflow:hidden;cursor:default;margin:0 2px 0;border:0;} .x-toolbar .ytb-spacer{width:2px;} .x-tbar-page-number{width:24px;height:14px;} .x-tbar-page-first{background-image:url(../images/default/grid/page-first.gif)!important;} .x-tbar-loading{background-image:url(../images/default/grid/done.gif)!important;} .x-tbar-page-last{background-image:url(../images/default/grid/page-last.gif)!important;} .x-tbar-page-next{background-image:url(../images/default/grid/page-next.gif)!important;} .x-tbar-page-prev{background-image:url(../images/default/grid/page-prev.gif)!important;} .x-item-disabled .x-tbar-loading{background-image:url(../images/default/grid/loading.gif)!important;} .x-item-disabled .x-tbar-page-first{background-image:url(../images/default/grid/page-first-disabled.gif)!important;} .x-item-disabled .x-tbar-page-last{background-image:url(../images/default/grid/page-last-disabled.gif)!important;} .x-item-disabled .x-tbar-page-next{background-image:url(../images/default/grid/page-next-disabled.gif)!important;} .x-item-disabled .x-tbar-page-prev{background-image:url(../images/default/grid/page-prev-disabled.gif)!important;} .x-paging-info{position:absolute;top:5px;right:8px;color:#444;} .x-resizable-handle{position:absolute;z-index:100;font-size:1px;line-height:6px;overflow:hidden;background:white;filter:alpha(opacity=0);opacity:0;zoom:1;} .x-resizable-handle-east{width:6px;cursor:e-resize;right:0;top:0;height:100%;} .ext-ie .x-resizable-handle-east{margin-right:-1px;} .x-resizable-handle-south{width:100%;cursor:s-resize;left:0;bottom:0;height:6px;} .ext-ie .x-resizable-handle-south{margin-bottom:-1px;} .x-resizable-handle-west{width:6px;cursor:w-resize;left:0;top:0;height:100%;} .x-resizable-handle-north{width:100%;cursor:n-resize;left:0;top:0;height:6px;} .x-resizable-handle-southeast{width:6px;cursor:se-resize;right:0;bottom:0;height:6px;z-index:101;} .x-resizable-handle-northwest{width:6px;cursor:nw-resize;left:0;top:0;height:6px;z-index:101;} .x-resizable-handle-northeast{width:6px;cursor:ne-resize;right:0;top:0;height:6px;z-index:101;} .x-resizable-handle-southwest{width:6px;cursor:sw-resize;left:0;bottom:0;height:6px;z-index:101;} .x-resizable-over .x-resizable-handle,.x-resizable-pinned .x-resizable-handle{filter:alpha(opacity=100);opacity:1;} .x-resizable-over .x-resizable-handle-east,.x-resizable-pinned .x-resizable-handle-east{background:url(../images/default/sizer/e-handle.gif);background-position:left;} .x-resizable-over .x-resizable-handle-west,.x-resizable-pinned .x-resizable-handle-west{background:url(../images/default/sizer/e-handle.gif);background-position:left;} .x-resizable-over .x-resizable-handle-south,.x-resizable-pinned .x-resizable-handle-south{background:url(../images/default/sizer/s-handle.gif);background-position:top;} .x-resizable-over .x-resizable-handle-north,.x-resizable-pinned .x-resizable-handle-north{background:url(../images/default/sizer/s-handle.gif);background-position:top;} .x-resizable-over .x-resizable-handle-southeast,.x-resizable-pinned .x-resizable-handle-southeast{background:url(../images/default/sizer/se-handle.gif);background-position:top left;} .x-resizable-over .x-resizable-handle-northwest,.x-resizable-pinned .x-resizable-handle-northwest{background:url(../images/default/sizer/nw-handle.gif);background-position:bottom right;} .x-resizable-over .x-resizable-handle-northeast,.x-resizable-pinned .x-resizable-handle-northeast{background:url(../images/default/sizer/ne-handle.gif);background-position:bottom left;} .x-resizable-over .x-resizable-handle-southwest,.x-resizable-pinned .x-resizable-handle-southwest{background:url(../images/default/sizer/sw-handle.gif);background-position:top right;} .x-resizable-proxy{border:1px dashed #3b5a82;position:absolute;overflow:hidden;display:none;left:0;top:0;z-index:50000;} .x-resizable-overlay{width:100%;height:100%;display:none;position:absolute;left:0;top:0;background:white;z-index:200000;-moz-opacity:0;opacity:0;filter:alpha(opacity=0);} .x-grid3{position:relative;overflow:hidden;background-color:#fff;} .x-grid-panel .x-panel-body{overflow:hidden!important;} .x-grid-panel .x-panel-mc .x-panel-body{border:1px solid #99bbe8;} .ext-ie .x-grid3 table,.ext-safari .x-grid3 table{table-layout:fixed;} .x-grid3-viewport{overflow:hidden;} .x-grid3-hd-row td,.x-grid3-row td,.x-grid3-summary-row td{font:normal 11px arial,tahoma,helvetica,sans-serif;-moz-outline:none;-moz-user-focus:normal;} .x-grid3-row td,.x-grid3-summary-row td{line-height:13px;vertical-align:top;padding-left:1px;padding-right:1px;-moz-user-select:none;} .x-grid3-hd-row td{line-height:15px;vertical-align:middle;border-left:1px solid #eee;border-right:1px solid #d0d0d0;} .x-grid3-hd-row .x-grid3-marker-hd{padding:3px;} .x-grid3-row .x-grid3-marker{padding:3px;} .x-grid3-cell-inner,.x-grid3-hd-inner{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;padding:3px 3px 3px 5px;white-space:nowrap;} .x-grid3-hd-inner{position:relative;cursor:inherit;padding:4px 3px 4px 5px;} .x-grid3-row-body{white-space:normal;} .x-grid3-body-cell{-moz-outline:0 none;outline:0 none;} .ext-ie .x-grid3-cell-inner,.ext-ie .x-grid3-hd-inner{width:100%;} .ext-strict .x-grid3-cell-inner,.ext-strict .x-grid3-hd-inner{width:auto;} .x-grid-row-loading{background:#fff url(../images/default/shared/loading-balls.gif) no-repeat center center;} .x-grid-page{overflow:hidden;} .x-grid3-row{cursor:default;border:1px solid #ededed;border-top-color:#fff;width:100%;} .x-grid3-row-alt{background-color:#fafafa;} .x-grid3-row-over{border:1px solid #ddd;background:#efefef url(../images/default/grid/row-over.gif) repeat-x left top;} .x-grid3-resize-proxy{width:1px;left:0;background-color:#777;cursor:e-resize;cursor:col-resize;position:absolute;top:0;height:100px;overflow:hidden;visibility:hidden;border:0 none;z-index:7;} .x-grid3-resize-marker{width:1px;left:0;background-color:#777;position:absolute;top:0;height:100px;overflow:hidden;visibility:hidden;border:0 none;z-index:7;} .x-grid3-focus{position:absolute;top:0;-moz-outline:0 none;outline:0 none;-moz-user-select:normal;-khtml-user-select:normal;} .x-grid3-header{background:#f9f9f9 url(../images/default/grid/grid3-hrow.gif) repeat-x 0 bottom;cursor:default;zoom:1;padding:1px 0 0 0;} .x-grid3-header-pop{border-left:1px solid #d0d0d0;float:right;clear:none;} .x-grid3-header-pop-inner{border-left:1px solid #eee;width:14px;height:19px;background:transparent url(../images/default/grid/hd-pop.gif) no-repeat center center;} .ext-ie .x-grid3-header-pop-inner{width:15px;} .ext-strict .x-grid3-header-pop-inner{width:14px;} .x-grid3-header-inner{overflow:hidden;zoom:1;float:left;} .x-grid3-header-offset{padding-left:1px;width:10000px;} td.x-grid3-hd-over,td.sort-desc,td.sort-asc,td.x-grid3-hd-menu-open{border-left:1px solid #aaccf6;border-right:1px solid #aaccf6;} td.x-grid3-hd-over .x-grid3-hd-inner,td.sort-desc .x-grid3-hd-inner,td.sort-asc .x-grid3-hd-inner,td.x-grid3-hd-menu-open .x-grid3-hd-inner{background:#ebf3fd url(../images/default/grid/grid3-hrow-over.gif) repeat-x left bottom;} .x-grid3-sort-icon{background-repeat:no-repeat;display:none;height:4px;width:13px;margin-left:3px;vertical-align:middle;} .sort-asc .x-grid3-sort-icon{background-image:url(../images/default/grid/sort_asc.gif);display:inline;} .sort-desc .x-grid3-sort-icon{background-image:url(../images/default/grid/sort_desc.gif);display:inline;} .ext-strict .ext-ie .x-grid3-header-inner{position:relative;} .ext-strict .ext-ie6 .x-grid3-hd{position:relative;} .ext-strict .ext-ie6 .x-grid3-hd-inner{position:static;} .x-grid3-body{zoom:1;} .x-grid3-scroller{overflow:auto;zoom:1;position:relative;} .x-grid3-cell-text,.x-grid3-hd-text{display:block;padding:3px 5px 3px 5px;-moz-user-select:none;-khtml-user-select:none;color:black;} .x-grid3-split{background-image:url(../images/default/grid/grid-split.gif);background-position:center;background-repeat:no-repeat;cursor:e-resize;cursor:col-resize;display:block;font-size:1px;height:16px;overflow:hidden;position:absolute;top:2px;width:6px;z-index:3;} .x-grid3-hd-text{color:#15428b;} .x-dd-drag-proxy .x-grid3-hd-inner{background:#ebf3fd url(../images/default/grid/grid3-hrow-over.gif) repeat-x left bottom;width:120px;padding:3px;border:1px solid #aaccf6;overflow:hidden;} .col-move-top,.col-move-bottom{width:9px;height:9px;position:absolute;top:0;line-height:1px;font-size:1px;overflow:hidden;visibility:hidden;z-index:20000;} .col-move-top{background:transparent url(../images/default/grid/col-move-top.gif) no-repeat left top;} .col-move-bottom{background:transparent url(../images/default/grid/col-move-bottom.gif) no-repeat left top;} .x-grid3-row-selected{background:#DFE8F6!important;border:1px dotted #a3bae9;} .x-grid3-cell-selected{background-color:#B8CFEE!important;color:black;} .x-grid3-cell-selected span{color:black!important;} .x-grid3-cell-selected .x-grid3-cell-text{color:black;} .x-grid3-locked td.x-grid3-row-marker,.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{background:#ebeadb url(../images/default/grid/grid-hrow.gif) repeat-x 0 bottom!important;vertical-align:middle!important;color:black;padding:0;border-top:1px solid white;border-bottom:none!important;border-right:1px solid #6fa0df!important;text-align:center;} .x-grid3-locked td.x-grid3-row-marker div,.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{padding:0 4px;color:#15428b!important;text-align:center;} .x-grid3-dirty-cell{background:transparent url(../images/default/grid/dirty.gif) no-repeat 0 0;} .x-grid3-topbar,.x-grid3-bottombar{font:normal 11px arial,tahoma,helvetica,sans-serif;overflow:hidden;display:none;zoom:1;position:relative;} .x-grid3-topbar .x-toolbar{border-right:0 none;} .x-grid3-bottombar .x-toolbar{border-right:0 none;border-bottom:0 none;border-top:1px solid #a9bfd3;} .x-props-grid .x-grid3-cell{padding:1px;} .x-props-grid .x-grid3-td-name .x-grid3-cell-inner{background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y -16px!important;padding-left:12px;color:black!important;} .x-props-grid .x-grid3-body .x-grid3-td-name{padding:1px;padding-right:0;background:white!important;border:0 none;border-right:1px solid #eee;} .xg-hmenu-sort-asc .x-menu-item-icon{background-image:url(../images/default/grid/hmenu-asc.gif);} .xg-hmenu-sort-desc .x-menu-item-icon{background-image:url(../images/default/grid/hmenu-desc.gif);} .xg-hmenu-lock .x-menu-item-icon{background-image:url(../images/default/grid/hmenu-lock.gif);} .xg-hmenu-unlock .x-menu-item-icon{background-image:url(../images/default/grid/hmenu-unlock.gif);} .x-grid3-col-dd{border:0 none;padding:0;background:transparent;} .x-dd-drag-ghost .x-grid3-dd-wrap{padding:1px 3px 3px 1px;} .x-grid3-hd{-moz-user-select:none;} .x-grid3-hd-btn{display:none;position:absolute;width:14px;background:#c3daf9 url(../images/default/grid/grid3-hd-btn.gif) no-repeat left center;right:0;top:0;z-index:2;cursor:pointer;} .x-grid3-hd-over .x-grid3-hd-btn,.x-grid3-hd-menu-open .x-grid3-hd-btn{display:block;} a.x-grid3-hd-btn:hover{background-position:-14px center;} .x-grid3-body .x-grid3-td-expander{background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right;} .x-grid3-body .x-grid3-td-expander .x-grid3-cell-inner{padding:0!important;height:100%;} .x-grid3-row-expander{width:100%;height:18px;background-position:4px 2px;background-repeat:no-repeat;background-color:transparent;background-image:url(../images/default/grid/row-expand-sprite.gif);} .x-grid3-row-collapsed .x-grid3-row-expander{background-position:4px 2px;} .x-grid3-row-expanded .x-grid3-row-expander{background-position:-21px 2px;} .x-grid3-row-collapsed .x-grid3-row-body{display:none!important;} .x-grid3-row-expanded .x-grid3-row-body{display:block!important;} .x-grid3-body .x-grid3-td-checker{background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right;} .x-grid3-body .x-grid3-td-checker .x-grid3-cell-inner,.x-grid3-header .x-grid3-td-checker .x-grid3-hd-inner{padding:0!important;height:100%;} .x-grid3-row-checker,.x-grid3-hd-checker{width:100%;height:18px;background-position:2px 2px;background-repeat:no-repeat;background-color:transparent;background-image:url(../images/default/grid/row-check-sprite.gif);} .x-grid3-row .x-grid3-row-checker{background-position:2px 2px;} .x-grid3-row-selected .x-grid3-row-checker,.x-grid3-hd-checker-on .x-grid3-hd-checker{background-position:-23px 2px;} .x-grid3-hd-checker{background-position:2px 3px;} .x-grid3-hd-checker-on .x-grid3-hd-checker{background-position:-23px 3px;} .x-grid3-body .x-grid3-td-numberer{background:transparent url(../images/default/grid/grid3-special-col-bg.gif) repeat-y right;} .x-grid3-body .x-grid3-td-numberer .x-grid3-cell-inner{padding:3px 5px 0 0!important;text-align:right;color:#444;} .x-grid3-body .x-grid3-row-selected .x-grid3-td-numberer,.x-grid3-body .x-grid3-row-selected .x-grid3-td-checker,.x-grid3-body .x-grid3-row-selected .x-grid3-td-expander{background:transparent url(../images/default/grid/grid3-special-col-sel-bg.gif) repeat-y right;} .x-grid3-body .x-grid3-check-col-td .x-grid3-cell-inner{padding:1px 0 0 0!important;} .x-grid3-check-col{width:100%;height:16px;background-position:center center;background-repeat:no-repeat;background-color:transparent;background-image:url(../images/default/menu/unchecked.gif);} .x-grid3-check-col-on{width:100%;height:16px;background-position:center center;background-repeat:no-repeat;background-color:transparent;background-image:url(../images/default/menu/checked.gif);} .x-grid-group,.x-grid-group-body,.x-grid-group-hd{zoom:1;} .x-grid-group-hd{border-bottom:2px solid #99bbe8;cursor:pointer;padding-top:6px;} .x-grid-group-hd div{background:transparent url(../images/default/grid/group-expand-sprite.gif) no-repeat 3px -47px;padding:4px 4px 4px 17px;color:#3764a0;font:bold 11px tahoma,arial,helvetica,sans-serif;} .x-grid-group-collapsed .x-grid-group-hd div{background-position:3px 3px;} .x-grid-group-collapsed .x-grid-group-body{display:none;} .x-group-by-icon{background-image:url(../images/default/grid/group-by.gif);} .x-cols-icon{background-image:url(../images/default/grid/columns.gif);} .x-show-groups-icon{background-image:url(../images/default/grid/group-by.gif);} .ext-ie .x-grid3 .x-editor .x-form-text{position:relative;top:-1px;} .ext-ie .x-props-grid .x-editor .x-form-text{position:static;top:0;} .x-grid-empty{padding:10px;color:gray;font:normal 11px tahoma,arial,helvetica,sans-serif;} .ext-ie7 .x-grid-panel .x-panel-bbar{position:relative;} .x-dd-drag-proxy{position:absolute;left:0;top:0;visibility:hidden;z-index:15000;} .x-dd-drag-ghost{color:black;font:normal 11px arial,helvetica,sans-serif;-moz-opacity:0.85;opacity:.85;filter:alpha(opacity=85);border-top:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #bbb;border-bottom:1px solid #bbb;padding:3px;padding-left:20px;background-color:white;white-space:nowrap;} .x-dd-drag-repair .x-dd-drag-ghost{-moz-opacity:0.4;opacity:.4;filter:alpha(opacity=40);border:0 none;padding:0;background-color:transparent;} .x-dd-drag-repair .x-dd-drop-icon{visibility:hidden;} .x-dd-drop-icon{position:absolute;top:3px;left:3px;display:block;width:16px;height:16px;background-color:transparent;background-position:center;background-repeat:no-repeat;z-index:1;} .x-dd-drop-nodrop .x-dd-drop-icon{background-image:url(../images/default/dd/drop-no.gif);} .x-dd-drop-ok .x-dd-drop-icon{background-image:url(../images/default/dd/drop-yes.gif);} .x-dd-drop-ok-add .x-dd-drop-icon{background-image:url(../images/default/dd/drop-add.gif);} .x-view-selector{position:absolute;left:0;top:0;width:0;background:#c3daf9;border:1px dotted #39b;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);zoom:1;} .x-tree .x-panel-body{background-color:#fff;} .ext-strict .ext-ie .x-tree .x-panel-bwrap{position:relative;overflow:hidden;} .x-tree-icon,.x-tree-ec-icon,.x-tree-elbow-line,.x-tree-elbow,.x-tree-elbow-end,.x-tree-elbow-plus,.x-tree-elbow-minus,.x-tree-elbow-end-plus,.x-tree-elbow-end-minus{border:0 none;height:18px;margin:0;padding:0;vertical-align:top;width:16px;background-repeat:no-repeat;} .x-tree-node-collapsed .x-tree-node-icon,.x-tree-node-expanded .x-tree-node-icon,.x-tree-node-leaf .x-tree-node-icon{border:0 none;height:18px;margin:0;padding:0;vertical-align:top;width:16px;background-position:center;background-repeat:no-repeat;} .ext-ie .x-tree-node-indent img,.ext-ie .x-tree-node-icon,.ext-ie .x-tree-ec-icon{vertical-align:middle!important;} .x-tree-node-expanded .x-tree-node-icon{background-image:url(../images/default/tree/folder-open.gif);} .x-tree-node-leaf .x-tree-node-icon{background-image:url(../images/default/tree/leaf.gif);} .x-tree-node-collapsed .x-tree-node-icon{background-image:url(../images/default/tree/folder.gif);} .ext-ie input.x-tree-node-cb{width:15px;height:15px;} input.x-tree-node-cb{margin-left:1px;} .ext-ie input.x-tree-node-cb{margin-left:0;} .x-tree-noicon .x-tree-node-icon{width:0;height:0;} .x-tree-node-loading .x-tree-node-icon{background-image:url(../images/default/tree/loading.gif)!important;} .x-tree-node-loading a span{font-style:italic;color:#444;} .ext-ie .x-tree-node-el input{width:15px;height:15px;} .x-tree-lines .x-tree-elbow{background-image:url(../images/default/tree/elbow.gif);} .x-tree-lines .x-tree-elbow-plus{background-image:url(../images/default/tree/elbow-plus.gif);} .x-tree-lines .x-tree-elbow-minus{background-image:url(../images/default/tree/elbow-minus.gif);} .x-tree-lines .x-tree-elbow-end{background-image:url(../images/default/tree/elbow-end.gif);} .x-tree-lines .x-tree-elbow-end-plus{background-image:url(../images/default/tree/elbow-end-plus.gif);} .x-tree-lines .x-tree-elbow-end-minus{background-image:url(../images/default/tree/elbow-end-minus.gif);} .x-tree-lines .x-tree-elbow-line{background-image:url(../images/default/tree/elbow-line.gif);} .x-tree-no-lines .x-tree-elbow{background:transparent;} .x-tree-no-lines .x-tree-elbow-plus{background-image:url(../images/default/tree/elbow-plus-nl.gif);} .x-tree-no-lines .x-tree-elbow-minus{background-image:url(../images/default/tree/elbow-minus-nl.gif);} .x-tree-no-lines .x-tree-elbow-end{background:transparent;} .x-tree-no-lines .x-tree-elbow-end-plus{background-image:url(../images/default/tree/elbow-end-plus-nl.gif);} .x-tree-no-lines .x-tree-elbow-end-minus{background-image:url(../images/default/tree/elbow-end-minus-nl.gif);} .x-tree-no-lines .x-tree-elbow-line{background:transparent;} .x-tree-arrows .x-tree-elbow{background:transparent;} .x-tree-arrows .x-tree-elbow-plus{background:transparent url(../images/default/tree/arrows.gif) no-repeat 0 0;} .x-tree-arrows .x-tree-elbow-minus{background:transparent url(../images/default/tree/arrows.gif) no-repeat -16px 0;} .x-tree-arrows .x-tree-elbow-end{background:transparent;} .x-tree-arrows .x-tree-elbow-end-plus{background:transparent url(../images/default/tree/arrows.gif) no-repeat 0 0;} .x-tree-arrows .x-tree-elbow-end-minus{background:transparent url(../images/default/tree/arrows.gif) no-repeat -16px 0;} .x-tree-arrows .x-tree-elbow-line{background:transparent;} .x-tree-arrows .x-tree-ec-over .x-tree-elbow-plus{background-position:-32px 0;} .x-tree-arrows .x-tree-ec-over .x-tree-elbow-minus{background-position:-48px 0;} .x-tree-arrows .x-tree-ec-over .x-tree-elbow-end-plus{background-position:-32px 0;} .x-tree-arrows .x-tree-ec-over .x-tree-elbow-end-minus{background-position:-48px 0;} .x-tree-elbow-plus,.x-tree-elbow-minus,.x-tree-elbow-end-plus,.x-tree-elbow-end-minus{cursor:pointer;} .ext-ie ul.x-tree-node-ct{font-size:0;line-height:0;zoom:1;} .x-tree-node{color:black;font:normal 11px arial,tahoma,helvetica,sans-serif;white-space:nowrap;} .x-tree-node-el{line-height:18px;cursor:pointer;} .x-tree-node a,.x-dd-drag-ghost a{text-decoration:none;color:black;-khtml-user-select:none;-moz-user-select:none;-kthml-user-focus:normal;-moz-user-focus:normal;-moz-outline:0 none;outline:0 none;} .x-tree-node a span,.x-dd-drag-ghost a span{text-decoration:none;color:black;padding:1px 3px 1px 2px;} .x-tree-node .x-tree-node-disabled a span{color:gray!important;} .x-tree-node .x-tree-node-disabled .x-tree-node-icon{-moz-opacity:0.5;opacity:.5;filter:alpha(opacity=50);} .x-tree-node .x-tree-node-inline-icon{background:transparent;} .x-tree-node a:hover,.x-dd-drag-ghost a:hover{text-decoration:none;} .x-tree-node div.x-tree-drag-insert-below{border-bottom:1px dotted #36c;} .x-tree-node div.x-tree-drag-insert-above{border-top:1px dotted #36c;} .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-below{border-bottom:0 none;} .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-above{border-top:0 none;} .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-below a{border-bottom:2px solid #36c;} .x-tree-dd-underline .x-tree-node div.x-tree-drag-insert-above a{border-top:2px solid #36c;} .x-tree-node .x-tree-drag-append a span{background:#ddd;border:1px dotted gray;} .x-tree-node .x-tree-node-over{background-color:#eee;} .x-tree-node .x-tree-selected{background-color:#d9e8fb;} .x-dd-drag-ghost .x-tree-node-indent,.x-dd-drag-ghost .x-tree-ec-icon{display:none!important;} .x-tree-drop-ok-append .x-dd-drop-icon{background-image:url(../images/default/tree/drop-add.gif);} .x-tree-drop-ok-above .x-dd-drop-icon{background-image:url(../images/default/tree/drop-over.gif);} .x-tree-drop-ok-below .x-dd-drop-icon{background-image:url(../images/default/tree/drop-under.gif);} .x-tree-drop-ok-between .x-dd-drop-icon{background-image:url(../images/default/tree/drop-between.gif);} .x-date-picker{border:1px solid #1b376c;border-top:0 none;background:#fff;position:relative;} .x-date-picker a{-moz-outline:0 none;outline:0 none;} .x-date-inner,.x-date-inner td,.x-date-inner th{border-collapse:separate;} .x-date-middle,.x-date-left,.x-date-right{background:url(../images/default/shared/hd-sprite.gif) repeat-x 0 -83px;color:#FFF;font:bold 11px "sans serif",tahoma,verdana,helvetica;overflow:hidden;} .x-date-middle .x-btn-left,.x-date-middle .x-btn-center,.x-date-middle .x-btn-right{background:transparent!important;vertical-align:middle;} .x-date-middle .x-btn .x-btn-text{color:#fff;} .x-date-middle .x-btn-with-menu .x-btn-center em{background:transparent url(../images/default/toolbar/btn-arrow-light.gif) no-repeat right 0;} .x-date-right,.x-date-left{width:18px;} .x-date-right{text-align:right;} .x-date-middle{padding-top:2px;padding-bottom:2px;} .x-date-right a,.x-date-left a{display:block;width:16px;height:16px;background-position:center;background-repeat:no-repeat;cursor:pointer;-moz-opacity:0.6;opacity:.6;filter:alpha(opacity=60);} .x-date-right a:hover,.x-date-left a:hover{-moz-opacity:1;opacity:1;filter:alpha(opacity=100);} .x-date-right a{background-image:url(../images/default/shared/right-btn.gif);margin-right:2px;text-decoration:none!important;} .x-date-left a{background-image:url(../images/default/shared/left-btn.gif);margin-left:2px;text-decoration:none!important;} table.x-date-inner{width:100%;table-layout:fixed;} .x-date-inner th{width:25px;} .x-date-inner th{background:#dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top;text-align:right!important;border-bottom:1px solid #a3bad9;font:normal 10px arial,helvetica,tahoma,sans-serif;color:#233d6d;cursor:default;padding:0;border-collapse:separate;} .x-date-inner th span{display:block;padding:2px;padding-right:7px;} .x-date-inner td{border:1px solid #fff;text-align:right;padding:0;} .x-date-inner a{padding:2px 5px;display:block;font:normal 11px arial,helvetica,tahoma,sans-serif;text-decoration:none;color:black;text-align:right;zoom:1;} .x-date-inner .x-date-active{cursor:pointer;color:black;} .x-date-inner .x-date-selected a{background:#dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top;border:1px solid #8db2e3;padding:1px 4px;} .x-date-inner .x-date-today a{border:1px solid darkred;padding:1px 4px;} .x-date-inner .x-date-selected span{font-weight:bold;} .x-date-inner .x-date-prevday a,.x-date-inner .x-date-nextday a{color:#aaa;text-decoration:none!important;} .x-date-bottom{padding:4px;border-top:1px solid #a3bad9;background:#dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top;} .x-date-inner a:hover,.x-date-inner .x-date-disabled a:hover{text-decoration:none!important;color:black;background:#ddecfe;} .x-date-inner .x-date-disabled a{cursor:default;background:#eee;color:#bbb;} .x-date-mmenu{background:#eee!important;} .x-date-mmenu .x-menu-item{font-size:10px;padding:1px 24px 1px 4px;white-space:nowrap;color:#000;} .x-date-mmenu .x-menu-item .x-menu-item-icon{width:10px;height:10px;margin-right:5px;background-position:center -4px!important;} .x-date-mp{position:absolute;left:0;top:0;background:white;display:none;} .x-date-mp td{padding:2px;font:normal 11px arial,helvetica,tahoma,sans-serif;} td.x-date-mp-month,td.x-date-mp-year,td.x-date-mp-ybtn{border:0 none;text-align:center;vertical-align:middle;width:25%;} .x-date-mp-ok{margin-right:3px;} .x-date-mp-btns button{text-decoration:none;text-align:center;text-decoration:none!important;background:#083772;color:white;border:1px solid;border-color:#36c #005 #005 #36c;padding:1px 3px 1px;font:normal 11px arial,helvetica,tahoma,sans-serif;cursor:pointer;} .x-date-mp-btns{background:#dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top;} .x-date-mp-btns td{border-top:1px solid #c5d2df;text-align:center;} td.x-date-mp-month a,td.x-date-mp-year a{display:block;padding:2px 4px;text-decoration:none;text-align:center;color:#15428b;} td.x-date-mp-month a:hover,td.x-date-mp-year a:hover{color:#15428b;text-decoration:none;cursor:pointer;background:#ddecfe;} td.x-date-mp-sel a{padding:1px 3px;background:#dfecfb url(../images/default/shared/glass-bg.gif) repeat-x left top;border:1px solid #8db2e3;} .x-date-mp-ybtn a{overflow:hidden;width:15px;height:15px;cursor:pointer;background:transparent url(../images/default/panel/tool-sprites.gif) no-repeat;display:block;margin:0 auto;} .x-date-mp-ybtn a.x-date-mp-next{background-position:0 -120px;} .x-date-mp-ybtn a.x-date-mp-next:hover{background-position:-15px -120px;} .x-date-mp-ybtn a.x-date-mp-prev{background-position:0 -105px;} .x-date-mp-ybtn a.x-date-mp-prev:hover{background-position:-15px -105px;} .x-date-mp-ybtn{text-align:center;} td.x-date-mp-sep{border-right:1px solid #c5d2df;} .x-tip{position:absolute;top:0;left:0;visibility:hidden;z-index:20000;border:0 none;} .x-tip .x-tip-close{background-image:url(../images/default/qtip/close.gif);height:15px;float:right;width:15px;margin:0 0 2px 2px;cursor:pointer;display:none;} .x-tip .x-tip-tc{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -62px;padding-top:3px;overflow:hidden;zoom:1;} .x-tip .x-tip-tl{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 0;padding-left:6px;overflow:hidden;zoom:1;} .x-tip .x-tip-tr{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right 0;padding-right:6px;overflow:hidden;zoom:1;} .x-tip .x-tip-bc{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -121px;height:3px;overflow:hidden;} .x-tip .x-tip-bl{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -59px;padding-left:6px;zoom:1;} .x-tip .x-tip-br{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right -59px;padding-right:6px;zoom:1;} .x-tip .x-tip-mc{border:0 none;font:normal 11px tahoma,arial,helvetica,sans-serif;} .x-tip .x-tip-ml{background:#fff url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -124px;padding-left:6px;zoom:1;} .x-tip .x-tip-mr{background:transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right -124px;padding-right:6px;zoom:1;} .ext-ie .x-tip .x-tip-header,.ext-ie .x-tip .x-tip-tc{font-size:0;line-height:0;} .x-tip .x-tip-header-text{font:bold 11px tahoma,arial,helvetica,sans-serif;padding:0;margin:0 0 2px 0;color:#444;} .x-tip .x-tip-body{font:normal 11px tahoma,arial,helvetica,sans-serif;margin:0!important;line-height:14px;color:#444;padding:0;} .x-tip .x-tip-body .loading-indicator{margin:0;} .x-tip-draggable .x-tip-header,.x-tip-draggable .x-tip-header-text{cursor:move;} .x-form-invalid-tip .x-tip-tc{background:url(../images/default/form/error-tip-corners.gif) repeat-x 0 -12px;padding-top:6px;} .x-form-invalid-tip .x-tip-tl{background-image:url(../images/default/form/error-tip-corners.gif);} .x-form-invalid-tip .x-tip-tr{background-image:url(../images/default/form/error-tip-corners.gif);} .x-form-invalid-tip .x-tip-bc{background:url(../images/default/form/error-tip-corners.gif) repeat-x 0 -18px;height:6px;} .x-form-invalid-tip .x-tip-bl{background:url(../images/default/form/error-tip-corners.gif) no-repeat 0 -6px;} .x-form-invalid-tip .x-tip-br{background:url(../images/default/form/error-tip-corners.gif) no-repeat right -6px;} .x-form-invalid-tip .x-tip-ml{background-image:url(../images/default/form/error-tip-corners.gif);} .x-form-invalid-tip .x-tip-mr{background-image:url(../images/default/form/error-tip-corners.gif);} .x-form-invalid-tip .x-tip-body{padding:2px;} .x-form-invalid-tip .x-tip-body{padding-left:24px;background:transparent url(../images/default/form/exclamation.gif) no-repeat 2px 2px;} .x-menu{border:1px solid #718bb7;z-index:15000;zoom:1;background:#f0f0f0 url(../images/default/menu/menu.gif) repeat-y;padding:2px;} .x-menu a{text-decoration:none!important;} .ext-ie .x-menu{zoom:1;overflow:hidden;} .x-menu-list{background:transparent;border:0 none;} .x-menu li{line-height:100%;} .x-menu li.x-menu-sep-li{font-size:1px;line-height:1px;} .x-menu-list-item{font:normal 11px tahoma,arial,sans-serif;white-space:nowrap;-moz-user-select:none;-khtml-user-select:none;display:block;padding:1px;} .x-menu-item-arrow{background:transparent url(../images/default/menu/menu-parent.gif) no-repeat right;} .x-menu-sep{display:block;font-size:1px;line-height:1px;margin:2px 3px;background-color:#e0e0e0;border-bottom:1px solid #fff;overflow:hidden;} .x-menu-focus{position:absolute;left:0;top:-5px;width:0;height:0;line-height:1px;} .x-menu a.x-menu-item{display:block;line-height:16px;padding:3px 21px 3px 3px;white-space:nowrap;text-decoration:none;color:#222;-moz-outline:0 none;outline:0 none;cursor:pointer;} .x-menu-item-active{background:#ebf3fd url(../images/default/menu/item-over.gif) repeat-x left bottom;border:1px solid #aaccf6;padding:0;} .x-menu-item-active a.x-menu-item{color:#233d6d;} .x-menu-item-icon{border:0 none;height:16px;padding:0;vertical-align:top;width:16px;margin:0 8px 0 0;background-position:center;} .x-menu-check-item .x-menu-item-icon{background:transparent url(../images/default/menu/unchecked.gif) no-repeat center;} .x-menu-item-checked .x-menu-item-icon{background-image:url(../images/default/menu/checked.gif);} .x-menu-group-item .x-menu-item-icon{background:transparent;} .x-menu-item-checked .x-menu-group-item .x-menu-item-icon{background:transparent url(../images/default/menu/group-checked.gif) no-repeat center;} .x-menu-plain{background:#fff!important;} .x-menu-date-item{padding:0;} .x-menu .x-color-palette,.x-menu .x-date-picker{margin-left:26px;margin-right:4px;} .x-menu .x-date-picker{border:1px solid #a3bad9;margin-top:2px;margin-bottom:2px;} .x-menu-plain .x-color-palette,.x-menu-plain .x-date-picker{margin:0;border:0 none;} .x-date-menu{padding:0!important;} .x-cycle-menu .x-menu-item-checked{border:1px dotted #a3bae9!important;background:#DFE8F6;padding:0;} .x-box-tl{background:transparent url(../images/default/box/corners.gif) no-repeat 0 0;zoom:1;} .x-box-tc{height:8px;background:transparent url(../images/default/box/tb.gif) repeat-x 0 0;overflow:hidden;} .x-box-tr{background:transparent url(../images/default/box/corners.gif) no-repeat right -8px;} .x-box-ml{background:transparent url(../images/default/box/l.gif) repeat-y 0;padding-left:4px;overflow:hidden;zoom:1;} .x-box-mc{background:#eee url(../images/default/box/tb.gif) repeat-x 0 -16px;padding:4px 10px;font-family:"Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif;color:#393939;font-size:12px;} .x-box-mc h3{font-size:14px;font-weight:bold;margin:0 0 4px 0;zoom:1;} .x-box-mr{background:transparent url(../images/default/box/r.gif) repeat-y right;padding-right:4px;overflow:hidden;} .x-box-bl{background:transparent url(../images/default/box/corners.gif) no-repeat 0 -16px;zoom:1;} .x-box-bc{background:transparent url(../images/default/box/tb.gif) repeat-x 0 -8px;height:8px;overflow:hidden;} .x-box-br{background:transparent url(../images/default/box/corners.gif) no-repeat right -24px;} .x-box-tl,.x-box-bl{padding-left:8px;overflow:hidden;} .x-box-tr,.x-box-br{padding-right:8px;overflow:hidden;} .x-box-blue .x-box-bl,.x-box-blue .x-box-br,.x-box-blue .x-box-tl,.x-box-blue .x-box-tr{background-image:url(../images/default/box/corners-blue.gif);} .x-box-blue .x-box-bc,.x-box-blue .x-box-mc,.x-box-blue .x-box-tc{background-image:url(../images/default/box/tb-blue.gif);} .x-box-blue .x-box-mc{background-color:#c3daf9;} .x-box-blue .x-box-mc h3{color:#17385b;} .x-box-blue .x-box-ml{background-image:url(../images/default/box/l-blue.gif);} .x-box-blue .x-box-mr{background-image:url(../images/default/box/r-blue.gif);} #x-debug-browser .x-tree .x-tree-node a span{color:#222297;font-size:11px;padding-top:2px;font-family:"monotype","courier new",sans-serif;line-height:18px;} #x-debug-browser .x-tree a i{color:#FF4545;font-style:normal;} #x-debug-browser .x-tree a em{color:#999;} #x-debug-browser .x-tree .x-tree-node .x-tree-selected a span{background:#c3daf9;} #x-debug-browser .x-tool-toggle{background-position:0 -75px;} #x-debug-browser .x-tool-toggle-over{background-position:-15px -75px;} #x-debug-browser.x-panel-collapsed .x-tool-toggle{background-position:0 -60px;} #x-debug-browser.x-panel-collapsed .x-tool-toggle-over{background-position:-15px -60px;} .x-combo-list{border:1px solid #98c0f4;background:#ddecfe;zoom:1;overflow:hidden;} .x-combo-list-inner{overflow:auto;background:white;position:relative;zoom:1;overflow-x:hidden;} .x-combo-list-hd{font:bold 11px tahoma,arial,helvetica,sans-serif;color:#15428b;background-image:url(../images/default/layout/panel-title-light-bg.gif);border-bottom:1px solid #98c0f4;padding:3px;} .x-resizable-pinned .x-combo-list-inner{border-bottom:1px solid #98c0f4;} .x-combo-list-item{font:normal 12px tahoma,arial,helvetica,sans-serif;padding:2px;border:1px solid #fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} .x-combo-list .x-combo-selected{border:1px dotted #a3bae9!important;background:#DFE8F6;cursor:pointer;} .x-combo-noedit{cursor:pointer;} .x-combo-list .x-toolbar{border-top:1px solid #98c0f4;border-bottom:0 none;} .x-combo-list-small .x-combo-list-item{font:normal 11px tahoma,arial,helvetica,sans-serif;} .x-panel{border-style:solid;border-color:#99bbe8;border-width:0;} .x-panel-header{overflow:hidden;zoom:1;color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 3px 4px 5px;border:1px solid #99bbe8;line-height:15px;background:transparent url(../images/default/panel/white-top-bottom.gif) repeat-x 0 -1px;} .x-panel-body{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;background:white;position:relative;} .x-panel-bbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-panel-tbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-panel-tbar-noheader .x-toolbar,.x-panel-mc .x-panel-tbar .x-toolbar{border-top:1px solid #99bbe8;border-bottom:0 none;} .x-panel-body-noheader,.x-panel-mc .x-panel-body{border-top:1px solid #99bbe8;} .x-panel-header{overflow:hidden;zoom:1;} .x-panel-tl .x-panel-header{color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 0 4px 0;border:0 none;background:transparent;} .x-panel-tl .x-panel-icon,.x-window-tl .x-panel-icon{padding-left:20px!important;background-repeat:no-repeat;background-position:0 4px;zoom:1;} .x-panel-inline-icon{width:16px;height:16px;background-repeat:no-repeat;background-position:0 0;vertical-align:middle;margin-right:4px;margin-top:-1px;margin-bottom:-1px;} .x-panel-tc{background:transparent url(../images/default/panel/top-bottom.gif) repeat-x 0 0;overflow:hidden;} .ext-strict .ext-ie7 .x-panel-tc{overflow:visible;} .x-panel-tl{background:transparent url(../images/default/panel/corners-sprite.gif) no-repeat 0 0;padding-left:6px;zoom:1;border-bottom:1px solid #99bbe8;} .x-panel-tr{background:transparent url(../images/default/panel/corners-sprite.gif) no-repeat right 0;zoom:1;padding-right:6px;} .x-panel-bc{background:transparent url(../images/default/panel/top-bottom.gif) repeat-x 0 bottom;zoom:1;} .x-panel-bc .x-panel-footer{zoom:1;} .x-panel-bl{background:transparent url(../images/default/panel/corners-sprite.gif) no-repeat 0 bottom;padding-left:6px;zoom:1;} .x-panel-br{background:transparent url(../images/default/panel/corners-sprite.gif) no-repeat right bottom;padding-right:6px;zoom:1;} .x-panel-mc{border:0 none;padding:0;margin:0;font:normal 11px tahoma,arial,helvetica,sans-serif;padding-top:6px;background:#dfe8f6;} .x-panel-mc .x-panel-body{background:transparent;border:0 none;} .x-panel-ml{background:#fff url(../images/default/panel/left-right.gif) repeat-y 0 0;padding-left:6px;zoom:1;} .x-panel-mr{background:transparent url(../images/default/panel/left-right.gif) repeat-y right 0;padding-right:6px;zoom:1;} .x-panel-bc .x-panel-footer{padding-bottom:6px;} .x-panel-nofooter .x-panel-bc{height:6px;font-size:0;line-height:0;} .x-panel-bwrap{overflow:hidden;zoom:1;} .x-panel-body{overflow:hidden;zoom:1;} .x-panel-collapsed .x-resizable-handle{display:none;} .ext-gecko .x-panel-animated div{overflow:hidden!important;} .x-plain-body{overflow:hidden;} .x-plain-bbar .x-toolbar{overflow:hidden;padding:2px;} .x-plain-tbar .x-toolbar{overflow:hidden;padding:2px;} .x-plain-bwrap{overflow:hidden;zoom:1;} .x-plain{overflow:hidden;} .x-tool{overflow:hidden;width:15px;height:15px;float:right;cursor:pointer;background:transparent url(../images/default/panel/tool-sprites.gif) no-repeat;margin-left:2px;} .x-tool-toggle{background-position:0 -60px;} .x-tool-toggle-over{background-position:-15px -60px;} .x-panel-collapsed .x-tool-toggle{background-position:0 -75px;} .x-panel-collapsed .x-tool-toggle-over{background-position:-15px -75px;} .x-tool-close{background-position:0 -0;} .x-tool-close-over{background-position:-15px 0;} .x-tool-minimize{background-position:0 -15px;} .x-tool-minimize-over{background-position:-15px -15px;} .x-tool-maximize{background-position:0 -30px;} .x-tool-maximize-over{background-position:-15px -30px;} .x-tool-restore{background-position:0 -45px;} .x-tool-restore-over{background-position:-15px -45px;} .x-tool-gear{background-position:0 -90px;} .x-tool-gear-over{background-position:-15px -90px;} .x-tool-pin{background-position:0 -135px;} .x-tool-pin-over{background-position:-15px -135px;} .x-tool-unpin{background-position:0 -150px;} .x-tool-unpin-over{background-position:-15px -150px;} .x-tool-right{background-position:0 -165px;} .x-tool-right-over{background-position:-15px -165px;} .x-tool-left{background-position:0 -180px;} .x-tool-left-over{background-position:-15px -180px;} .x-tool-up{background-position:0 -210px;} .x-tool-up-over{background-position:-15px -210px;} .x-tool-down{background-position:0 -195px;} .x-tool-down-over{background-position:-15px -195px;} .x-tool-refresh{background-position:0 -225px;} .x-tool-refresh-over{background-position:-15px -225px;} .x-tool-minus{background-position:0 -255px;} .x-tool-minus-over{background-position:-15px -255px;} .x-tool-plus{background-position:0 -240px;} .x-tool-plus-over{background-position:-15px -240px;} .x-tool-search{background-position:0 -270px;} .x-tool-search-over{background-position:-15px -270px;} .x-tool-save{background-position:0 -285px;} .x-tool-save-over{background-position:-15px -285px;} .x-tool-help{background-position:0 -300px;} .x-tool-help-over{background-position:-15px -300px;} .x-tool-print{background-position:0 -315px;} .x-tool-print-over{background-position:-15px -315px;} .x-panel-ghost{background:#cbddf3;z-index:12000;overflow:hidden;position:absolute;left:0;top:0;opacity:.65;-moz-opacity:.65;filter:alpha(opacity=65);} .x-panel-ghost ul{margin:0;padding:0;overflow:hidden;font-size:0;line-height:0;border:1px solid #99bbe8;border-top:0 none;display:block;} .x-panel-ghost *{cursor:move!important;} .x-panel-dd-spacer{border:2px dashed #99bbe8;} .x-panel-btns-ct{padding:5px;} .x-panel-btns-ct .x-btn{float:right;clear:none;} .x-panel-btns-ct .x-panel-btns td{border:0;padding:0;} .x-panel-btns-ct .x-panel-btns-right table{float:right;clear:none;} .x-panel-btns-ct .x-panel-btns-left table{float:left;clear:none;} .x-panel-btns-ct .x-panel-btns-center{text-align:center;} .x-panel-btns-ct .x-panel-btns-center table{margin:0 auto;} .x-panel-btns-ct table td.x-panel-btn-td{padding:3px;} .x-panel-btns-ct .x-btn-focus .x-btn-left{background-position:0 -147px;} .x-panel-btns-ct .x-btn-focus .x-btn-right{background-position:0 -168px;} .x-panel-btns-ct .x-btn-focus .x-btn-center{background-position:0 -189px;} .x-panel-btns-ct .x-btn-over .x-btn-left{background-position:0 -63px;} .x-panel-btns-ct .x-btn-over .x-btn-right{background-position:0 -84px;} .x-panel-btns-ct .x-btn-over .x-btn-center{background-position:0 -105px;} .x-panel-btns-ct .x-btn-click .x-btn-center{background-position:0 -126px;} .x-panel-btns-ct .x-btn-click .x-btn-right{background-position:0 -84px;} .x-panel-btns-ct .x-btn-click .x-btn-left{background-position:0 -63px;} .x-window{zoom:1;} .x-window .x-resizable-handle{opacity:0;-moz-opacity:0;filter:alpha(opacity=0);} .x-window-proxy{background:#C7DFFC;border:1px solid #99bbe8;z-index:12000;overflow:hidden;position:absolute;left:0;top:0;display:none;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);} .x-window-header{overflow:hidden;zoom:1;} .x-window-bwrap{z-index:1;position:relative;zoom:1;} .x-window-tl .x-window-header{color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 0 4px 0;} .x-window-header-text{cursor:pointer;} .x-window-tc{background:transparent url(../images/default/window/top-bottom.png) repeat-x 0 0;overflow:hidden;zoom:1;} .x-window-tl{background:transparent url(../images/default/window/left-corners.png) no-repeat 0 0;padding-left:6px;zoom:1;z-index:1;position:relative;} .x-window-tr{background:transparent url(../images/default/window/right-corners.png) no-repeat right 0;padding-right:6px;} .x-window-bc{background:transparent url(../images/default/window/top-bottom.png) repeat-x 0 bottom;zoom:1;} .x-window-bc .x-window-footer{padding-bottom:6px;zoom:1;font-size:0;line-height:0;} .x-window-bl{background:transparent url(../images/default/window/left-corners.png) no-repeat 0 bottom;padding-left:6px;zoom:1;} .x-window-br{background:transparent url(../images/default/window/right-corners.png) no-repeat right bottom;padding-right:6px;zoom:1;} .x-window-mc{border:1px solid #99bbe8;padding:0;margin:0;font:normal 11px tahoma,arial,helvetica,sans-serif;background:#dfe8f6;} .x-window-ml{background:transparent url(../images/default/window/left-right.png) repeat-y 0 0;padding-left:6px;zoom:1;} .x-window-mr{background:transparent url(../images/default/window/left-right.png) repeat-y right 0;padding-right:6px;zoom:1;} .x-panel-nofooter .x-window-bc{height:6px;} .x-window-body{overflow:hidden;} .x-window-bwrap{overflow:hidden;} .x-window-maximized .x-window-bl,.x-window-maximized .x-window-br,.x-window-maximized .x-window-ml,.x-window-maximized .x-window-mr,.x-window-maximized .x-window-tl,.x-window-maximized .x-window-tr{padding:0;} .x-window-maximized .x-window-footer{padding-bottom:0;} .x-window-maximized .x-window-tc{padding-left:3px;padding-right:3px;background-color:white;} .x-window-maximized .x-window-mc{border-left:0 none;border-right:0 none;} .x-window-tbar .x-toolbar,.x-window-bbar .x-toolbar{border-left:0 none;border-right:0 none;} .x-window-bbar .x-toolbar{border-top:1px solid #99bbe8;border-bottom:0 none;} .x-window-draggable,.x-window-draggable .x-window-header-text{cursor:move;} .x-window-maximized .x-window-draggable,.x-window-maximized .x-window-draggable .x-window-header-text{cursor:default;} .x-window-body{background:transparent;} .x-panel-ghost .x-window-tl{border-bottom:1px solid #99bbe8;} .x-panel-collapsed .x-window-tl{border-bottom:1px solid #84a0c4;} .x-window-maximized-ct{overflow:hidden;} .x-window-maximized .x-resizable-handle{display:none;} .x-window-sizing-ghost ul{border:0 none!important;} .x-dlg-focus{-moz-outline:0 none;outline:0 none;width:0;height:0;overflow:hidden;position:absolute;top:0;left:0;} .x-dlg-mask{z-index:10000;display:none;position:absolute;top:0;left:0;-moz-opacity:0.5;opacity:.50;filter:alpha(opacity=50);background-color:#CCC;} body.ext-ie6.x-body-masked select{visibility:hidden;} body.ext-ie6.x-body-masked .x-window select{visibility:visible;} .x-window-plain .x-window-mc{background:#CAD9EC;border-right:1px solid #DFE8F6;border-bottom:1px solid #DFE8F6;border-top:1px solid #a3bae9;border-left:1px solid #a3bae9;} .x-window-plain .x-window-body{border-left:1px solid #DFE8F6;border-top:1px solid #DFE8F6;border-bottom:1px solid #a3bae9;border-right:1px solid #a3bae9;background:transparent!important;} body.x-body-masked .x-window-plain .x-window-mc{background:#C7D6E9;} .x-html-editor-wrap{border:1px solid #a9bfd3;background:white;} .x-html-editor-tb .x-btn-text{background:transparent url(../images/default/editor/tb-sprite.gif) no-repeat;} .x-html-editor-tb .x-edit-bold .x-btn-text{background-position:0 0;} .x-html-editor-tb .x-edit-italic .x-btn-text{background-position:-16px 0;} .x-html-editor-tb .x-edit-underline .x-btn-text{background-position:-32px 0;} .x-html-editor-tb .x-edit-forecolor .x-btn-text{background-position:-160px 0;} .x-html-editor-tb .x-edit-backcolor .x-btn-text{background-position:-176px 0;} .x-html-editor-tb .x-edit-justifyleft .x-btn-text{background-position:-112px 0;} .x-html-editor-tb .x-edit-justifycenter .x-btn-text{background-position:-128px 0;} .x-html-editor-tb .x-edit-justifyright .x-btn-text{background-position:-144px 0;} .x-html-editor-tb .x-edit-insertorderedlist .x-btn-text{background-position:-80px 0;} .x-html-editor-tb .x-edit-insertunorderedlist .x-btn-text{background-position:-96px 0;} .x-html-editor-tb .x-edit-increasefontsize .x-btn-text{background-position:-48px 0;} .x-html-editor-tb .x-edit-decreasefontsize .x-btn-text{background-position:-64px 0;} .x-html-editor-tb .x-edit-sourceedit .x-btn-text{background-position:-192px 0;} .x-html-editor-tb .x-edit-createlink .x-btn-text{background-position:-208px 0;} .x-html-editor-tip .x-tip-bd .x-tip-bd-inner{padding:5px;padding-bottom:1px;} .x-html-editor-tb .x-toolbar{position:static!important;} .x-panel-noborder .x-panel-body-noborder{border-width:0;} .x-panel-noborder .x-panel-header-noborder{border-width:0;border-bottom:1px solid #99bbe8;} .x-panel-noborder .x-panel-tbar-noborder .x-toolbar{border-width:0;border-bottom:1px solid #99bbe8;} .x-panel-noborder .x-panel-bbar-noborder .x-toolbar{border-width:0;border-top:1px solid #99bbe8;} .x-window-noborder .x-window-mc{border-width:0;} .x-window-plain .x-window-body-noborder{border-width:0;} .x-tab-panel-noborder .x-tab-panel-body-noborder{border-width:0;} .x-tab-panel-noborder .x-tab-panel-header-noborder{border-top-width:0;border-left-width:0;border-right-width:0;} .x-tab-panel-noborder .x-tab-panel-footer-noborder{border-bottom-width:0;border-left-width:0;border-right-width:0;} .x-tab-panel-bbar-noborder .x-toolbar{border-width:0;border-top:1px solid #99bbe8;} .x-tab-panel-tbar-noborder .x-toolbar{border-width:0;border-bottom:1px solid #99bbe8;} .x-border-layout-ct{background:#dfe8f6;} .x-border-panel{position:absolute;left:0;top:0;} .x-tool-collapse-south{background-position:0 -195px;} .x-tool-collapse-south-over{background-position:-15px -195px;} .x-tool-collapse-north{background-position:0 -210px;} .x-tool-collapse-north-over{background-position:-15px -210px;} .x-tool-collapse-west{background-position:0 -180px;} .x-tool-collapse-west-over{background-position:-15px -180px;} .x-tool-collapse-east{background-position:0 -165px;} .x-tool-collapse-east-over{background-position:-15px -165px;} .x-tool-expand-south{background-position:0 -210px;} .x-tool-expand-south-over{background-position:-15px -210px;} .x-tool-expand-north{background-position:0 -195px;} .x-tool-expand-north-over{background-position:-15px -195px;} .x-tool-expand-west{background-position:0 -165px;} .x-tool-expand-west-over{background-position:-15px -165px;} .x-tool-expand-east{background-position:0 -180px;} .x-tool-expand-east-over{background-position:-15px -180px;} .x-tool-expand-north,.x-tool-expand-south{float:right;margin:3px;} .x-tool-expand-east,.x-tool-expand-west{float:none;margin:3px auto;} .x-accordion-hd .x-tool-toggle{background-position:0 -255px;} .x-accordion-hd .x-tool-toggle-over{background-position:-15px -255px;} .x-panel-collapsed .x-accordion-hd .x-tool-toggle{background-position:0 -240px;} .x-panel-collapsed .x-accordion-hd .x-tool-toggle-over{background-position:-15px -240px;} .x-accordion-hd{color:#222;padding-top:4px;padding-bottom:3px;border-top:0 none;font-weight:normal;background:transparent url(../images/default/panel/light-hd.gif) repeat-x 0 -9px;} .x-layout-collapsed{position:absolute;left:-10000px;top:-10000px;visibility:hidden;background-color:#d2e0f2;width:20px;height:20px;overflow:hidden;border:1px solid #98c0f4;z-index:20;} .ext-border-box .x-layout-collapsed{width:22px;height:22px;} .x-layout-collapsed-over{cursor:pointer;background-color:#d9e8fb;} .x-layout-collapsed-west .x-layout-collapsed-tools,.x-layout-collapsed-east .x-layout-collapsed-tools{position:absolute;top:0;left:0;width:20px;height:20px;} .x-layout-split{position:absolute;height:5px;width:5px;line-height:1px;font-size:1px;z-index:3;background-color:transparent;} .x-layout-split-h{background-image:url(../images/default/s.gif);background-position:left;} .x-layout-split-v{background-image:url(../images/default/s.gif);background-position:top;} .x-column-layout-ct{overflow:hidden;zoom:1;} .x-column{float:left;padding:0;margin:0;overflow:hidden;zoom:1;} .x-layout-mini{position:absolute;top:0;left:0;display:block;width:5px;height:35px;cursor:pointer;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);} .x-layout-mini-over,.x-layout-collapsed-over .x-layout-mini{opacity:1;-moz-opacity:1;filter:none;} .x-layout-split-west .x-layout-mini{top:48%;background-image:url(../images/default/layout/mini-left.gif);} .x-layout-split-east .x-layout-mini{top:48%;background-image:url(../images/default/layout/mini-right.gif);} .x-layout-split-north .x-layout-mini{left:48%;height:5px;width:35px;background-image:url(../images/default/layout/mini-top.gif);} .x-layout-split-south .x-layout-mini{left:48%;height:5px;width:35px;background-image:url(../images/default/layout/mini-bottom.gif);} .x-layout-cmini-west .x-layout-mini{top:48%;background-image:url(../images/default/layout/mini-right.gif);} .x-layout-cmini-east .x-layout-mini{top:48%;background-image:url(../images/default/layout/mini-left.gif);} .x-layout-cmini-north .x-layout-mini{left:48%;height:5px;width:35px;background-image:url(../images/default/layout/mini-bottom.gif);} .x-layout-cmini-south .x-layout-mini{left:48%;height:5px;width:35px;background-image:url(../images/default/layout/mini-top.gif);} .x-layout-cmini-west,.x-layout-cmini-east{border:0 none;width:5px!important;padding:0;background:transparent;} .x-layout-cmini-north,.x-layout-cmini-south{border:0 none;height:5px!important;padding:0;background:transparent;} .x-viewport,.x-viewport body{margin:0;padding:0;border:0 none;overflow:hidden;height:100%;} .x-abs-layout-item{position:absolute;left:0;top:0;} .ext-ie input.x-abs-layout-item,.ext-ie textarea.x-abs-layout-item{margin:0;} .x-progress-wrap{border:1px solid #6593cf;overflow:hidden;} .x-progress-inner{height:18px;background:#e0e8f3 url(../images/default/qtip/bg.gif) repeat-x;position:relative;} .x-progress-bar{height:18px;float:left;width:0;background:#9CBFEE url( ../images/default/progress/progress-bg.gif ) repeat-x left center;border-top:1px solid #D1E4FD;border-bottom:1px solid #7FA9E4;border-right:1px solid #7FA9E4;} .x-progress-text{font-size:11px;font-weight:bold;color:#fff;padding:1px 5px;overflow:hidden;position:absolute;left:0;text-align:center;} .x-progress-text-back{color:#396095;line-height:16px;} .ext-ie .x-progress-text-back{line-height:15px;} .x-window-dlg .x-window-body{border:0 none!important;padding:5px 10px;overflow:hidden!important;} .x-window-dlg .x-window-mc{border:0 none!important;} .x-window-dlg .ext-mb-text,.x-window-dlg .x-window-header-text{font-size:12px;} .x-window-dlg .ext-mb-input{margin-top:4px;width:95%;} .x-window-dlg .ext-mb-textarea{margin-top:4px;font:normal 12px tahoma,arial,helvetica,sans-serif;} .x-window-dlg .x-progress-wrap{margin-top:4px;} .ext-ie .x-window-dlg .x-progress-wrap{margin-top:6px;} .x-window-dlg .x-msg-box-wait{background:transparent url(../images/default/grid/loading.gif) no-repeat left;display:block;width:300px;padding-left:18px;line-height:18px;} .x-window-dlg .ext-mb-icon{float:left;width:47px;height:32px;} .ext-ie .x-window-dlg .ext-mb-icon{width:44px;} .x-window-dlg .ext-mb-info{background:transparent url(../images/default/window/icon-info.gif) no-repeat top left;} .x-window-dlg .ext-mb-warning{background:transparent url(../images/default/window/icon-warning.gif) no-repeat top left;} .x-window-dlg .ext-mb-question{background:transparent url(../images/default/window/icon-question.gif) no-repeat top left;} .x-window-dlg .ext-mb-error{background:transparent url(../images/default/window/icon-error.gif) no-repeat top left;}
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/ext-all.css
CSS
mit
78,815
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-menu { border: 1px solid #718bb7; z-index: 15000; zoom: 1; background: #f0f0f0 url(../images/default/menu/menu.gif) repeat-y; padding: 2px; } .x-menu a { text-decoration: none !important; } .ext-ie .x-menu { zoom:1; overflow:hidden; } .x-menu-list{ background:transparent; border:0 none; } .x-menu li{ line-height:100%; } .x-menu li.x-menu-sep-li{ font-size:1px; line-height:1px; } .x-menu-list-item{ font:normal 11px tahoma,arial, sans-serif; white-space: nowrap; -moz-user-select: none; -khtml-user-select: none; display:block; padding:1px; } .x-menu-item-arrow{ background:transparent url(../images/default/menu/menu-parent.gif) no-repeat right; } .x-menu-sep { display:block; font-size:1px; line-height:1px; margin: 2px 3px; background-color:#e0e0e0; border-bottom:1px solid #fff; overflow:hidden; } .x-menu-focus { position:absolute; left:0; top:-5px; width:0; height:0; line-height:1px; } .x-menu a.x-menu-item { display:block; line-height:16px; padding:3px 21px 3px 3px; white-space: nowrap; text-decoration:none; color:#222; -moz-outline: 0 none; outline: 0 none; cursor:pointer; } .x-menu-item-active { background: #ebf3fd url(../images/default/menu/item-over.gif) repeat-x left bottom; border:1px solid #aaccf6; padding: 0; } .x-menu-item-active a.x-menu-item { color: #233d6d; } .x-menu-item-icon { border: 0 none; height: 16px; padding: 0; vertical-align: top; width: 16px; margin: 0 8px 0 0; background-position:center; } .x-menu-check-item .x-menu-item-icon{ background: transparent url(../images/default/menu/unchecked.gif) no-repeat center; } .x-menu-item-checked .x-menu-item-icon{ background-image:url(../images/default/menu/checked.gif); } .x-menu-group-item .x-menu-item-icon{ background: transparent; } .x-menu-item-checked .x-menu-group-item .x-menu-item-icon{ background: transparent url(../images/default/menu/group-checked.gif) no-repeat center; } .x-menu-plain { background:#fff !important; } .x-menu-date-item{ padding:0; } .x-menu .x-color-palette, .x-menu .x-date-picker{ margin-left: 26px; margin-right:4px; } .x-menu .x-date-picker{ border:1px solid #a3bad9; margin-top:2px; margin-bottom:2px; } .x-menu-plain .x-color-palette, .x-menu-plain .x-date-picker{ margin: 0; border: 0 none; } .x-date-menu { padding:0 !important; } .x-cycle-menu .x-menu-item-checked { border:1px dotted #a3bae9 !important; background:#DFE8F6; padding:0; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/menu.css
CSS
mit
2,762
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-combo-list { border:1px solid #98c0f4; background:#ddecfe; zoom:1; overflow:hidden; } .x-combo-list-inner { overflow:auto; background:white; position:relative; /* for calculating scroll offsets */ zoom:1; overflow-x:hidden; } .x-combo-list-hd { font:bold 11px tahoma, arial, helvetica, sans-serif; color:#15428b; background-image: url(../images/default/layout/panel-title-light-bg.gif); border-bottom:1px solid #98c0f4; padding:3px; } .x-resizable-pinned .x-combo-list-inner { border-bottom:1px solid #98c0f4; } .x-combo-list-item { font:normal 12px tahoma, arial, helvetica, sans-serif; padding:2px; border:1px solid #fff; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; } .x-combo-list .x-combo-selected{ border:1px dotted #a3bae9 !important; background:#DFE8F6; cursor:pointer; } .x-combo-noedit{ cursor:pointer; } .x-combo-list .x-toolbar { border-top:1px solid #98c0f4; border-bottom:0 none; } .x-combo-list-small .x-combo-list-item { font:normal 11px tahoma, arial, helvetica, sans-serif; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/combo.css
CSS
mit
1,305
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-progress-wrap { border:1px solid #6593cf; overflow:hidden; } .x-progress-inner { height:18px; background: #e0e8f3 url(../images/default/qtip/bg.gif) repeat-x; position:relative; } .x-progress-bar { height:18px; float:left; width:0; background:#9CBFEE url( ../images/default/progress/progress-bg.gif ) repeat-x left center; border-top:1px solid #D1E4FD; border-bottom:1px solid #7FA9E4; border-right:1px solid #7FA9E4; } .x-progress-text { font-size:11px; font-weight:bold; color:#fff; padding:1px 5px; overflow:hidden; position:absolute; left:0; text-align:center; } .x-progress-text-back { color:#396095; line-height:16px; } .ext-ie .x-progress-text-back { line-height:15px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/progress.css
CSS
mit
941
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ .x-tip{ position: absolute; top: 0; left:0; visibility: hidden; z-index: 20000; border:0 none; } .x-tip .x-tip-close{ background-image: url(../images/default/qtip/close.gif); height: 15px; float:right; width: 15px; margin:0 0 2px 2px; cursor:pointer; display:none; } .x-tip .x-tip-tc { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -62px; padding-top:3px; overflow:hidden; zoom:1; } .x-tip .x-tip-tl { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 0; padding-left:6px; overflow:hidden; zoom:1; } .x-tip .x-tip-tr { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right 0; padding-right:6px; overflow:hidden; zoom:1; } .x-tip .x-tip-bc { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -121px; height:3px; overflow:hidden; } .x-tip .x-tip-bl { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -59px; padding-left:6px; zoom:1; } .x-tip .x-tip-br { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right -59px; padding-right:6px; zoom:1; } .x-tip .x-tip-mc { border:0 none; font: normal 11px tahoma,arial,helvetica,sans-serif; } .x-tip .x-tip-ml { background: #fff url(../images/default/qtip/tip-sprite.gif) no-repeat 0 -124px; padding-left:6px; zoom:1; } .x-tip .x-tip-mr { background: transparent url(../images/default/qtip/tip-sprite.gif) no-repeat right -124px; padding-right:6px; zoom:1; } .ext-ie .x-tip .x-tip-header,.ext-ie .x-tip .x-tip-tc { font-size:0; line-height:0; } .x-tip .x-tip-header-text { font: bold 11px tahoma,arial,helvetica,sans-serif; padding:0; margin:0 0 2px 0; color:#444; } .x-tip .x-tip-body { font: normal 11px tahoma,arial,helvetica,sans-serif; margin:0 !important; line-height:14px; color:#444; padding:0; } .x-tip .x-tip-body .loading-indicator { margin:0; } .x-tip-draggable .x-tip-header,.x-tip-draggable .x-tip-header-text { cursor:move; } .x-form-invalid-tip { } .x-form-invalid-tip .x-tip-tc { background: url(../images/default/form/error-tip-corners.gif) repeat-x 0 -12px; padding-top:6px; } .x-form-invalid-tip .x-tip-tl { background-image: url(../images/default/form/error-tip-corners.gif); } .x-form-invalid-tip .x-tip-tr { background-image: url(../images/default/form/error-tip-corners.gif); } .x-form-invalid-tip .x-tip-bc { background: url(../images/default/form/error-tip-corners.gif) repeat-x 0 -18px; height:6px; } .x-form-invalid-tip .x-tip-bl { background: url(../images/default/form/error-tip-corners.gif) no-repeat 0 -6px; } .x-form-invalid-tip .x-tip-br { background: url(../images/default/form/error-tip-corners.gif) no-repeat right -6px; } .x-form-invalid-tip .x-tip-ml { background-image: url(../images/default/form/error-tip-corners.gif); } .x-form-invalid-tip .x-tip-mr { background-image: url(../images/default/form/error-tip-corners.gif); } .x-form-invalid-tip .x-tip-body { padding:2px; } .x-form-invalid-tip .x-tip-body { padding-left:24px; background:transparent url(../images/default/form/exclamation.gif) no-repeat 2px 2px; }
08to09-processwave
oryx/editor/lib/ext-2.0.2/resources/css/qtips.css
CSS
mit
3,515
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.DomHelper = function(){ var tempTableEl = null; var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i; var tableRe = /^table|tbody|tr|td$/i; var createHtml = function(o){ if(typeof o == 'string'){ return o; } var b = ""; if (Ext.isArray(o)) { for (var i = 0, l = o.length; i < l; i++) { b += createHtml(o[i]); } return b; } if(!o.tag){ o.tag = "div"; } b += "<" + o.tag; for(var attr in o){ if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue; if(attr == "style"){ var s = o["style"]; if(typeof s == "function"){ s = s.call(); } if(typeof s == "string"){ b += ' style="' + s + '"'; }else if(typeof s == "object"){ b += ' style="'; for(var key in s){ if(typeof s[key] != "function"){ b += key + ":" + s[key] + ";"; } } b += '"'; } }else{ if(attr == "cls"){ b += ' class="' + o["cls"] + '"'; }else if(attr == "htmlFor"){ b += ' for="' + o["htmlFor"] + '"'; }else{ b += " " + attr + '="' + o[attr] + '"'; } } } if(emptyTags.test(o.tag)){ b += "/>"; }else{ b += ">"; var cn = o.children || o.cn; if(cn){ b += createHtml(cn); } else if(o.html){ b += o.html; } b += "</" + o.tag + ">"; } return b; }; var createDom = function(o, parentNode){ var el; if (Ext.isArray(o)) { el = document.createDocumentFragment(); for(var i = 0, l = o.length; i < l; i++) { createDom(o[i], el); } } else if (typeof o == "string)") { el = document.createTextNode(o); } else { el = document.createElement(o.tag||'div'); var useSet = !!el.setAttribute; for(var attr in o){ if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue; if(attr=="cls"){ el.className = o["cls"]; }else{ if(useSet) el.setAttribute(attr, o[attr]); else el[attr] = o[attr]; } } Ext.DomHelper.applyStyles(el, o.style); var cn = o.children || o.cn; if(cn){ createDom(cn, el); } else if(o.html){ el.innerHTML = o.html; } } if(parentNode){ parentNode.appendChild(el); } return el; }; var ieTable = function(depth, s, h, e){ tempTableEl.innerHTML = [s, h, e].join(''); var i = -1, el = tempTableEl; while(++i < depth){ el = el.firstChild; } return el; }; var ts = '<table>', te = '</table>', tbs = ts+'<tbody>', tbe = '</tbody>'+te, trs = tbs + '<tr>', tre = '</tr>'+tbe; var insertIntoTable = function(tag, where, el, html){ if(!tempTableEl){ tempTableEl = document.createElement('div'); } var node; var before = null; if(tag == 'td'){ if(where == 'afterbegin' || where == 'beforeend'){ return; } if(where == 'beforebegin'){ before = el; el = el.parentNode; } else{ before = el.nextSibling; el = el.parentNode; } node = ieTable(4, trs, html, tre); } else if(tag == 'tr'){ if(where == 'beforebegin'){ before = el; el = el.parentNode; node = ieTable(3, tbs, html, tbe); } else if(where == 'afterend'){ before = el.nextSibling; el = el.parentNode; node = ieTable(3, tbs, html, tbe); } else{ if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(4, trs, html, tre); } } else if(tag == 'tbody'){ if(where == 'beforebegin'){ before = el; el = el.parentNode; node = ieTable(2, ts, html, te); } else if(where == 'afterend'){ before = el.nextSibling; el = el.parentNode; node = ieTable(2, ts, html, te); } else{ if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(3, tbs, html, tbe); } } else{ if(where == 'beforebegin' || where == 'afterend'){ return; } if(where == 'afterbegin'){ before = el.firstChild; } node = ieTable(2, ts, html, te); } el.insertBefore(node, before); return node; }; return { useDom : false, markup : function(o){ return createHtml(o); }, applyStyles : function(el, styles){ if(styles){ el = Ext.fly(el); if(typeof styles == "string"){ var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi; var matches; while ((matches = re.exec(styles)) != null){ el.setStyle(matches[1], matches[2]); } }else if (typeof styles == "object"){ for (var style in styles){ el.setStyle(style, styles[style]); } }else if (typeof styles == "function"){ Ext.DomHelper.applyStyles(el, styles.call()); } } }, insertHtml : function(where, el, html){ where = where.toLowerCase(); if(el.insertAdjacentHTML){ if(tableRe.test(el.tagName)){ var rs; if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){ return rs; } } switch(where){ case "beforebegin": el.insertAdjacentHTML('BeforeBegin', html); return el.previousSibling; case "afterbegin": el.insertAdjacentHTML('AfterBegin', html); return el.firstChild; case "beforeend": el.insertAdjacentHTML('BeforeEnd', html); return el.lastChild; case "afterend": el.insertAdjacentHTML('AfterEnd', html); return el.nextSibling; } throw 'Illegal insertion point -> "' + where + '"'; } var range = el.ownerDocument.createRange(); var frag; switch(where){ case "beforebegin": range.setStartBefore(el); frag = range.createContextualFragment(html); el.parentNode.insertBefore(frag, el); return el.previousSibling; case "afterbegin": if(el.firstChild){ range.setStartBefore(el.firstChild); frag = range.createContextualFragment(html); el.insertBefore(frag, el.firstChild); return el.firstChild; }else{ el.innerHTML = html; return el.firstChild; } case "beforeend": if(el.lastChild){ range.setStartAfter(el.lastChild); frag = range.createContextualFragment(html); el.appendChild(frag); return el.lastChild; }else{ el.innerHTML = html; return el.lastChild; } case "afterend": range.setStartAfter(el); frag = range.createContextualFragment(html); el.parentNode.insertBefore(frag, el.nextSibling); return el.nextSibling; } throw 'Illegal insertion point -> "' + where + '"'; }, insertBefore : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "beforeBegin"); }, insertAfter : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling"); }, insertFirst : function(el, o, returnElement){ return this.doInsert(el, o, returnElement, "afterBegin", "firstChild"); }, doInsert : function(el, o, returnElement, pos, sibling){ el = Ext.getDom(el); var newNode; if(this.useDom){ newNode = createDom(o, null); (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el); }else{ var html = createHtml(o); newNode = this.insertHtml(pos, el, html); } return returnElement ? Ext.get(newNode, true) : newNode; }, append : function(el, o, returnElement){ el = Ext.getDom(el); var newNode; if(this.useDom){ newNode = createDom(o, null); el.appendChild(newNode); }else{ var html = createHtml(o); newNode = this.insertHtml("beforeEnd", el, html); } return returnElement ? Ext.get(newNode, true) : newNode; }, overwrite : function(el, o, returnElement){ el = Ext.getDom(el); el.innerHTML = createHtml(o); return returnElement ? Ext.get(el.firstChild, true) : el.firstChild; }, createTemplate : function(o){ var html = createHtml(o); return new Ext.Template(html); } }; }(); Ext.Template = function(html){ var a = arguments; if(Ext.isArray(html)){ html = html.join(""); }else if(a.length > 1){ var buf = []; for(var i = 0, len = a.length; i < len; i++){ if(typeof a[i] == 'object'){ Ext.apply(this, a[i]); }else{ buf[buf.length] = a[i]; } } html = buf.join(''); } this.html = html; if(this.compiled){ this.compile(); } }; Ext.Template.prototype = { applyTemplate : function(values){ if(this.compiled){ return this.compiled(values); } var useF = this.disableFormats !== true; var fm = Ext.util.Format, tpl = this; var fn = function(m, name, format, args){ if(format && useF){ if(format.substr(0, 5) == "this."){ return tpl.call(format.substr(5), values[name], values); }else{ if(args){ var re = /^\s*['"](.*)["']\s*$/; args = args.split(','); for(var i = 0, len = args.length; i < len; i++){ args[i] = args[i].replace(re, "$1"); } args = [values[name]].concat(args); }else{ args = [values[name]]; } return fm[format].apply(fm, args); } }else{ return values[name] !== undefined ? values[name] : ""; } }; return this.html.replace(this.re, fn); }, set : function(html, compile){ this.html = html; this.compiled = null; if(compile){ this.compile(); } return this; }, disableFormats : false, re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g, compile : function(){ var fm = Ext.util.Format; var useF = this.disableFormats !== true; var sep = Ext.isGecko ? "+" : ","; var fn = function(m, name, format, args){ if(format && useF){ args = args ? ',' + args : ""; if(format.substr(0, 5) != "this."){ format = "fm." + format + '('; }else{ format = 'this.call("'+ format.substr(5) + '", '; args = ", values"; } }else{ args= ''; format = "(values['" + name + "'] == undefined ? '' : "; } return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'"; }; var body; if(Ext.isGecko){ body = "this.compiled = function(values){ return '" + this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) + "';};"; }else{ body = ["this.compiled = function(values){ return ['"]; body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn)); body.push("'].join('');};"); body = body.join(''); } eval(body); return this; }, call : function(fnName, value, allValues){ return this[fnName](value, allValues); }, insertFirst: function(el, values, returnElement){ return this.doInsert('afterBegin', el, values, returnElement); }, insertBefore: function(el, values, returnElement){ return this.doInsert('beforeBegin', el, values, returnElement); }, insertAfter : function(el, values, returnElement){ return this.doInsert('afterEnd', el, values, returnElement); }, append : function(el, values, returnElement){ return this.doInsert('beforeEnd', el, values, returnElement); }, doInsert : function(where, el, values, returnEl){ el = Ext.getDom(el); var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values)); return returnEl ? Ext.get(newNode, true) : newNode; }, overwrite : function(el, values, returnElement){ el = Ext.getDom(el); el.innerHTML = this.applyTemplate(values); return returnElement ? Ext.get(el.firstChild, true) : el.firstChild; } }; Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; Ext.DomHelper.Template = Ext.Template; Ext.Template.from = function(el, config){ el = Ext.getDom(el); return new Ext.Template(el.value || el.innerHTML, config || ''); }; Ext.DomQuery = function(){ var cache = {}, simpleCache = {}, valueCache = {}; var nonSpace = /\S/; var trimRe = /^\s+|\s+$/g; var tplRe = /\{(\d+)\}/g; var modeRe = /^(\s?[\/>+~]\s?|\s|$)/; var tagTokenRe = /^(#)?([\w-\*]+)/; var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/; function child(p, index){ var i = 0; var n = p.firstChild; while(n){ if(n.nodeType == 1){ if(++i == index){ return n; } } n = n.nextSibling; } return null; }; function next(n){ while((n = n.nextSibling) && n.nodeType != 1); return n; }; function prev(n){ while((n = n.previousSibling) && n.nodeType != 1); return n; }; function children(d){ var n = d.firstChild, ni = -1; while(n){ var nx = n.nextSibling; if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ d.removeChild(n); }else{ n.nodeIndex = ++ni; } n = nx; } return this; }; function byClassName(c, a, v){ if(!v){ return c; } var r = [], ri = -1, cn; for(var i = 0, ci; ci = c[i]; i++){ if((' '+ci.className+' ').indexOf(v) != -1){ r[++ri] = ci; } } return r; }; function attrValue(n, attr){ if(!n.tagName && typeof n.length != "undefined"){ n = n[0]; } if(!n){ return null; } if(attr == "for"){ return n.htmlFor; } if(attr == "class" || attr == "className"){ return n.className; } return n.getAttribute(attr) || n[attr]; }; function getNodes(ns, mode, tagName){ var result = [], ri = -1, cs; if(!ns){ return result; } tagName = tagName || "*"; if(typeof ns.getElementsByTagName != "undefined"){ ns = [ns]; } if(!mode){ for(var i = 0, ni; ni = ns[i]; i++){ cs = ni.getElementsByTagName(tagName); for(var j = 0, ci; ci = cs[j]; j++){ result[++ri] = ci; } } }else if(mode == "/" || mode == ">"){ var utag = tagName.toUpperCase(); for(var i = 0, ni, cn; ni = ns[i]; i++){ cn = ni.children || ni.childNodes; for(var j = 0, cj; cj = cn[j]; j++){ if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){ result[++ri] = cj; } } } }else if(mode == "+"){ var utag = tagName.toUpperCase(); for(var i = 0, n; n = ns[i]; i++){ while((n = n.nextSibling) && n.nodeType != 1); if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){ result[++ri] = n; } } }else if(mode == "~"){ for(var i = 0, n; n = ns[i]; i++){ while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName))); if(n){ result[++ri] = n; } } } return result; }; function concat(a, b){ if(b.slice){ return a.concat(b); } for(var i = 0, l = b.length; i < l; i++){ a[a.length] = b[i]; } return a; } function byTag(cs, tagName){ if(cs.tagName || cs == document){ cs = [cs]; } if(!tagName){ return cs; } var r = [], ri = -1; tagName = tagName.toLowerCase(); for(var i = 0, ci; ci = cs[i]; i++){ if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ r[++ri] = ci; } } return r; }; function byId(cs, attr, id){ if(cs.tagName || cs == document){ cs = [cs]; } if(!id){ return cs; } var r = [], ri = -1; for(var i = 0,ci; ci = cs[i]; i++){ if(ci && ci.id == id){ r[++ri] = ci; return r; } } return r; }; function byAttribute(cs, attr, value, op, custom){ var r = [], ri = -1, st = custom=="{"; var f = Ext.DomQuery.operators[op]; for(var i = 0, ci; ci = cs[i]; i++){ var a; if(st){ a = Ext.DomQuery.getStyle(ci, attr); } else if(attr == "class" || attr == "className"){ a = ci.className; }else if(attr == "for"){ a = ci.htmlFor; }else if(attr == "href"){ a = ci.getAttribute("href", 2); }else{ a = ci.getAttribute(attr); } if((f && f(a, value)) || (!f && a)){ r[++ri] = ci; } } return r; }; function byPseudo(cs, name, value){ return Ext.DomQuery.pseudos[name](cs, value); }; var isIE = window.ActiveXObject ? true : false; eval("var batch = 30803;"); var key = 30803; function nodupIEXml(cs){ var d = ++key; cs[0].setAttribute("_nodup", d); var r = [cs[0]]; for(var i = 1, len = cs.length; i < len; i++){ var c = cs[i]; if(!c.getAttribute("_nodup") != d){ c.setAttribute("_nodup", d); r[r.length] = c; } } for(var i = 0, len = cs.length; i < len; i++){ cs[i].removeAttribute("_nodup"); } return r; } function nodup(cs){ if(!cs){ return []; } var len = cs.length, c, i, r = cs, cj, ri = -1; if(!len || typeof cs.nodeType != "undefined" || len == 1){ return cs; } if(isIE && typeof cs[0].selectSingleNode != "undefined"){ return nodupIEXml(cs); } var d = ++key; cs[0]._nodup = d; for(i = 1; c = cs[i]; i++){ if(c._nodup != d){ c._nodup = d; }else{ r = []; for(var j = 0; j < i; j++){ r[++ri] = cs[j]; } for(j = i+1; cj = cs[j]; j++){ if(cj._nodup != d){ cj._nodup = d; r[++ri] = cj; } } return r; } } return r; } function quickDiffIEXml(c1, c2){ var d = ++key; for(var i = 0, len = c1.length; i < len; i++){ c1[i].setAttribute("_qdiff", d); } var r = []; for(var i = 0, len = c2.length; i < len; i++){ if(c2[i].getAttribute("_qdiff") != d){ r[r.length] = c2[i]; } } for(var i = 0, len = c1.length; i < len; i++){ c1[i].removeAttribute("_qdiff"); } return r; } function quickDiff(c1, c2){ var len1 = c1.length; if(!len1){ return c2; } if(isIE && c1[0].selectSingleNode){ return quickDiffIEXml(c1, c2); } var d = ++key; for(var i = 0; i < len1; i++){ c1[i]._qdiff = d; } var r = []; for(var i = 0, len = c2.length; i < len; i++){ if(c2[i]._qdiff != d){ r[r.length] = c2[i]; } } return r; } function quickId(ns, mode, root, id){ if(ns == root){ var d = root.ownerDocument || root; return d.getElementById(id); } ns = getNodes(ns, mode, "*"); return byId(ns, null, id); } return { getStyle : function(el, name){ return Ext.fly(el).getStyle(name); }, compile : function(path, type){ type = type || "select"; var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"]; var q = path, mode, lq; var tk = Ext.DomQuery.matchers; var tklen = tk.length; var mm; var lmode = q.match(modeRe); if(lmode && lmode[1]){ fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";'; q = q.replace(lmode[1], ""); } while(path.substr(0, 1)=="/"){ path = path.substr(1); } while(q && lq != q){ lq = q; var tm = q.match(tagTokenRe); if(type == "select"){ if(tm){ if(tm[1] == "#"){ fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; }else{ fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; } q = q.replace(tm[0], ""); }else if(q.substr(0, 1) != '@'){ fn[fn.length] = 'n = getNodes(n, mode, "*");'; } }else{ if(tm){ if(tm[1] == "#"){ fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; }else{ fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; } q = q.replace(tm[0], ""); } } while(!(mm = q.match(modeRe))){ var matched = false; for(var j = 0; j < tklen; j++){ var t = tk[j]; var m = q.match(t.re); if(m){ fn[fn.length] = t.select.replace(tplRe, function(x, i){ return m[i]; }); q = q.replace(m[0], ""); matched = true; break; } } if(!matched){ throw 'Error parsing selector, parsing failed at "' + q + '"'; } } if(mm[1]){ fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";'; q = q.replace(mm[1], ""); } } fn[fn.length] = "return nodup(n);\n}"; eval(fn.join("")); return f; }, select : function(path, root, type){ if(!root || root == document){ root = document; } if(typeof root == "string"){ root = document.getElementById(root); } var paths = path.split(","); var results = []; for(var i = 0, len = paths.length; i < len; i++){ var p = paths[i].replace(trimRe, ""); if(!cache[p]){ cache[p] = Ext.DomQuery.compile(p); if(!cache[p]){ throw p + " is not a valid selector"; } } var result = cache[p](root); if(result && result != document){ results = results.concat(result); } } if(paths.length > 1){ return nodup(results); } return results; }, selectNode : function(path, root){ return Ext.DomQuery.select(path, root)[0]; }, selectValue : function(path, root, defaultValue){ path = path.replace(trimRe, ""); if(!valueCache[path]){ valueCache[path] = Ext.DomQuery.compile(path, "select"); } var n = valueCache[path](root); n = n[0] ? n[0] : n; var v = (n && n.firstChild ? n.firstChild.nodeValue : null); return ((v === null||v === undefined||v==='') ? defaultValue : v); }, selectNumber : function(path, root, defaultValue){ var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0); return parseFloat(v); }, is : function(el, ss){ if(typeof el == "string"){ el = document.getElementById(el); } var isArray = Ext.isArray(el); var result = Ext.DomQuery.filter(isArray ? el : [el], ss); return isArray ? (result.length == el.length) : (result.length > 0); }, filter : function(els, ss, nonMatches){ ss = ss.replace(trimRe, ""); if(!simpleCache[ss]){ simpleCache[ss] = Ext.DomQuery.compile(ss, "simple"); } var result = simpleCache[ss](els); return nonMatches ? quickDiff(result, els) : result; }, matchers : [{ re: /^\.([\w-]+)/, select: 'n = byClassName(n, null, " {1} ");' }, { re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/, select: 'n = byPseudo(n, "{1}", "{2}");' },{ re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/, select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");' }, { re: /^#([\w-]+)/, select: 'n = byId(n, null, "{1}");' },{ re: /^@([\w-]+)/, select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};' } ], operators : { "=" : function(a, v){ return a == v; }, "!=" : function(a, v){ return a != v; }, "^=" : function(a, v){ return a && a.substr(0, v.length) == v; }, "$=" : function(a, v){ return a && a.substr(a.length-v.length) == v; }, "*=" : function(a, v){ return a && a.indexOf(v) !== -1; }, "%=" : function(a, v){ return (a % v) == 0; }, "|=" : function(a, v){ return a && (a == v || a.substr(0, v.length+1) == v+'-'); }, "~=" : function(a, v){ return a && (' '+a+' ').indexOf(' '+v+' ') != -1; } }, pseudos : { "first-child" : function(c){ var r = [], ri = -1, n; for(var i = 0, ci; ci = n = c[i]; i++){ while((n = n.previousSibling) && n.nodeType != 1); if(!n){ r[++ri] = ci; } } return r; }, "last-child" : function(c){ var r = [], ri = -1, n; for(var i = 0, ci; ci = n = c[i]; i++){ while((n = n.nextSibling) && n.nodeType != 1); if(!n){ r[++ri] = ci; } } return r; }, "nth-child" : function(c, a) { var r = [], ri = -1; var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a); var f = (m[1] || 1) - 0, l = m[2] - 0; for(var i = 0, n; n = c[i]; i++){ var pn = n.parentNode; if (batch != pn._batch) { var j = 0; for(var cn = pn.firstChild; cn; cn = cn.nextSibling){ if(cn.nodeType == 1){ cn.nodeIndex = ++j; } } pn._batch = batch; } if (f == 1) { if (l == 0 || n.nodeIndex == l){ r[++ri] = n; } } else if ((n.nodeIndex + l) % f == 0){ r[++ri] = n; } } return r; }, "only-child" : function(c){ var r = [], ri = -1;; for(var i = 0, ci; ci = c[i]; i++){ if(!prev(ci) && !next(ci)){ r[++ri] = ci; } } return r; }, "empty" : function(c){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var cns = ci.childNodes, j = 0, cn, empty = true; while(cn = cns[j]){ ++j; if(cn.nodeType == 1 || cn.nodeType == 3){ empty = false; break; } } if(empty){ r[++ri] = ci; } } return r; }, "contains" : function(c, v){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if((ci.textContent||ci.innerText||'').indexOf(v) != -1){ r[++ri] = ci; } } return r; }, "nodeValue" : function(c, v){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(ci.firstChild && ci.firstChild.nodeValue == v){ r[++ri] = ci; } } return r; }, "checked" : function(c){ var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(ci.checked == true){ r[++ri] = ci; } } return r; }, "not" : function(c, ss){ return Ext.DomQuery.filter(c, ss, true); }, "any" : function(c, selectors){ var ss = selectors.split('|'); var r = [], ri = -1, s; for(var i = 0, ci; ci = c[i]; i++){ for(var j = 0; s = ss[j]; j++){ if(Ext.DomQuery.is(ci, s)){ r[++ri] = ci; break; } } } return r; }, "odd" : function(c){ return this["nth-child"](c, "odd"); }, "even" : function(c){ return this["nth-child"](c, "even"); }, "nth" : function(c, a){ return c[a-1] || []; }, "first" : function(c){ return c[0] || []; }, "last" : function(c){ return c[c.length-1] || []; }, "has" : function(c, ss){ var s = Ext.DomQuery.select; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ if(s(ss, ci).length > 0){ r[++ri] = ci; } } return r; }, "next" : function(c, ss){ var is = Ext.DomQuery.is; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var n = next(ci); if(n && is(n, ss)){ r[++ri] = ci; } } return r; }, "prev" : function(c, ss){ var is = Ext.DomQuery.is; var r = [], ri = -1; for(var i = 0, ci; ci = c[i]; i++){ var n = prev(ci); if(n && is(n, ss)){ r[++ri] = ci; } } return r; } } }; }(); Ext.query = Ext.DomQuery.select; Ext.util.Observable = function(){ if(this.listeners){ this.on(this.listeners); delete this.listeners; } }; Ext.util.Observable.prototype = { fireEvent : function(){ if(this.eventsSuspended !== true){ var ce = this.events[arguments[0].toLowerCase()]; if(typeof ce == "object"){ return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1)); } } return true; }, filterOptRe : /^(?:scope|delay|buffer|single)$/, addListener : function(eventName, fn, scope, o){ if(typeof eventName == "object"){ o = eventName; for(var e in o){ if(this.filterOptRe.test(e)){ continue; } if(typeof o[e] == "function"){ this.addListener(e, o[e], o.scope, o); }else{ this.addListener(e, o[e].fn, o[e].scope, o[e]); } } return; } o = (!o || typeof o == "boolean") ? {} : o; eventName = eventName.toLowerCase(); var ce = this.events[eventName] || true; if(typeof ce == "boolean"){ ce = new Ext.util.Event(this, eventName); this.events[eventName] = ce; } ce.addListener(fn, scope, o); }, removeListener : function(eventName, fn, scope){ var ce = this.events[eventName.toLowerCase()]; if(typeof ce == "object"){ ce.removeListener(fn, scope); } }, purgeListeners : function(){ for(var evt in this.events){ if(typeof this.events[evt] == "object"){ this.events[evt].clearListeners(); } } }, relayEvents : function(o, events){ var createHandler = function(ename){ return function(){ return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0))); }; }; for(var i = 0, len = events.length; i < len; i++){ var ename = events[i]; if(!this.events[ename]){ this.events[ename] = true; }; o.on(ename, createHandler(ename), this); } }, addEvents : function(o){ if(!this.events){ this.events = {}; } if(typeof o == 'string'){ for(var i = 0, a = arguments, v; v = a[i]; i++){ if(!this.events[a[i]]){ o[a[i]] = true; } } }else{ Ext.applyIf(this.events, o); } }, hasListener : function(eventName){ var e = this.events[eventName]; return typeof e == "object" && e.listeners.length > 0; }, suspendEvents : function(){ this.eventsSuspended = true; }, resumeEvents : function(){ this.eventsSuspended = false; }, getMethodEvent : function(method){ if(!this.methodEvents){ this.methodEvents = {}; } var e = this.methodEvents[method]; if(!e){ e = {}; this.methodEvents[method] = e; e.originalFn = this[method]; e.methodName = method; e.before = []; e.after = []; var returnValue, v, cancel; var obj = this; var makeCall = function(fn, scope, args){ if((v = fn.apply(scope || obj, args)) !== undefined){ if(typeof v === 'object'){ if(v.returnValue !== undefined){ returnValue = v.returnValue; }else{ returnValue = v; } if(v.cancel === true){ cancel = true; } }else if(v === false){ cancel = true; }else { returnValue = v; } } } this[method] = function(){ returnValue = v = undefined; cancel = false; var args = Array.prototype.slice.call(arguments, 0); for(var i = 0, len = e.before.length; i < len; i++){ makeCall(e.before[i].fn, e.before[i].scope, args); if(cancel){ return returnValue; } } if((v = e.originalFn.apply(obj, args)) !== undefined){ returnValue = v; } for(var i = 0, len = e.after.length; i < len; i++){ makeCall(e.after[i].fn, e.after[i].scope, args); if(cancel){ return returnValue; } } return returnValue; }; } return e; }, beforeMethod : function(method, fn, scope){ var e = this.getMethodEvent(method); e.before.push({fn: fn, scope: scope}); }, afterMethod : function(method, fn, scope){ var e = this.getMethodEvent(method); e.after.push({fn: fn, scope: scope}); }, removeMethodListener : function(method, fn, scope){ var e = this.getMethodEvent(method); for(var i = 0, len = e.before.length; i < len; i++){ if(e.before[i].fn == fn && e.before[i].scope == scope){ e.before.splice(i, 1); return; } } for(var i = 0, len = e.after.length; i < len; i++){ if(e.after[i].fn == fn && e.after[i].scope == scope){ e.after.splice(i, 1); return; } } } }; Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener; Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener; Ext.util.Observable.capture = function(o, fn, scope){ o.fireEvent = o.fireEvent.createInterceptor(fn, scope); }; Ext.util.Observable.releaseCapture = function(o){ o.fireEvent = Ext.util.Observable.prototype.fireEvent; }; (function(){ var createBuffered = function(h, o, scope){ var task = new Ext.util.DelayedTask(); return function(){ task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0)); }; }; var createSingle = function(h, e, fn, scope){ return function(){ e.removeListener(fn, scope); return h.apply(scope, arguments); }; }; var createDelayed = function(h, o, scope){ return function(){ var args = Array.prototype.slice.call(arguments, 0); setTimeout(function(){ h.apply(scope, args); }, o.delay || 10); }; }; Ext.util.Event = function(obj, name){ this.name = name; this.obj = obj; this.listeners = []; }; Ext.util.Event.prototype = { addListener : function(fn, scope, options){ scope = scope || this.obj; if(!this.isListening(fn, scope)){ var l = this.createListener(fn, scope, options); if(!this.firing){ this.listeners.push(l); }else{ this.listeners = this.listeners.slice(0); this.listeners.push(l); } } }, createListener : function(fn, scope, o){ o = o || {}; scope = scope || this.obj; var l = {fn: fn, scope: scope, options: o}; var h = fn; if(o.delay){ h = createDelayed(h, o, scope); } if(o.single){ h = createSingle(h, this, fn, scope); } if(o.buffer){ h = createBuffered(h, o, scope); } l.fireFn = h; return l; }, findListener : function(fn, scope){ scope = scope || this.obj; var ls = this.listeners; for(var i = 0, len = ls.length; i < len; i++){ var l = ls[i]; if(l.fn == fn && l.scope == scope){ return i; } } return -1; }, isListening : function(fn, scope){ return this.findListener(fn, scope) != -1; }, removeListener : function(fn, scope){ var index; if((index = this.findListener(fn, scope)) != -1){ if(!this.firing){ this.listeners.splice(index, 1); }else{ this.listeners = this.listeners.slice(0); this.listeners.splice(index, 1); } return true; } return false; }, clearListeners : function(){ this.listeners = []; }, fire : function(){ var ls = this.listeners, scope, len = ls.length; if(len > 0){ this.firing = true; var args = Array.prototype.slice.call(arguments, 0); for(var i = 0; i < len; i++){ var l = ls[i]; if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){ this.firing = false; return false; } } this.firing = false; } return true; } }; })(); Ext.EventManager = function(){ var docReadyEvent, docReadyProcId, docReadyState = false; var resizeEvent, resizeTask, textEvent, textSize; var E = Ext.lib.Event; var D = Ext.lib.Dom; var fireDocReady = function(){ if(!docReadyState){ docReadyState = true; Ext.isReady = true; if(docReadyProcId){ clearInterval(docReadyProcId); } if(Ext.isGecko || Ext.isOpera) { document.removeEventListener("DOMContentLoaded", fireDocReady, false); } if(Ext.isIE){ var defer = document.getElementById("ie-deferred-loader"); if(defer){ defer.onreadystatechange = null; defer.parentNode.removeChild(defer); } } if(docReadyEvent){ docReadyEvent.fire(); docReadyEvent.clearListeners(); } } }; var initDocReady = function(){ docReadyEvent = new Ext.util.Event(); if(Ext.isGecko || Ext.isOpera) { document.addEventListener("DOMContentLoaded", fireDocReady, false); }else if(Ext.isIE){ document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>"); var defer = document.getElementById("ie-deferred-loader"); defer.onreadystatechange = function(){ if(this.readyState == "complete"){ fireDocReady(); } }; }else if(Ext.isSafari){ docReadyProcId = setInterval(function(){ var rs = document.readyState; if(rs == "complete") { fireDocReady(); } }, 10); } E.on(window, "load", fireDocReady); }; var createBuffered = function(h, o){ var task = new Ext.util.DelayedTask(h); return function(e){ e = new Ext.EventObjectImpl(e); task.delay(o.buffer, h, null, [e]); }; }; var createSingle = function(h, el, ename, fn){ return function(e){ Ext.EventManager.removeListener(el, ename, fn); h(e); }; }; var createDelayed = function(h, o){ return function(e){ e = new Ext.EventObjectImpl(e); setTimeout(function(){ h(e); }, o.delay || 10); }; }; var listen = function(element, ename, opt, fn, scope){ var o = (!opt || typeof opt == "boolean") ? {} : opt; fn = fn || o.fn; scope = scope || o.scope; var el = Ext.getDom(element); if(!el){ throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.'; } var h = function(e){ e = Ext.EventObject.setEvent(e); var t; if(o.delegate){ t = e.getTarget(o.delegate, el); if(!t){ return; } }else{ t = e.target; } if(o.stopEvent === true){ e.stopEvent(); } if(o.preventDefault === true){ e.preventDefault(); } if(o.stopPropagation === true){ e.stopPropagation(); } if(o.normalized === false){ e = e.browserEvent; } fn.call(scope || el, e, t, o); }; if(o.delay){ h = createDelayed(h, o); } if(o.single){ h = createSingle(h, el, ename, fn); } if(o.buffer){ h = createBuffered(h, o); } fn._handlers = fn._handlers || []; fn._handlers.push([Ext.id(el), ename, h]); E.on(el, ename, h); if(ename == "mousewheel" && el.addEventListener){ el.addEventListener("DOMMouseScroll", h, false); E.on(window, 'unload', function(){ el.removeEventListener("DOMMouseScroll", h, false); }); } if(ename == "mousedown" && el == document){ Ext.EventManager.stoppedMouseDownEvent.addListener(h); } return h; }; var stopListening = function(el, ename, fn){ var id = Ext.id(el), hds = fn._handlers, hd = fn; if(hds){ for(var i = 0, len = hds.length; i < len; i++){ var h = hds[i]; if(h[0] == id && h[1] == ename){ hd = h[2]; hds.splice(i, 1); break; } } } E.un(el, ename, hd); el = Ext.getDom(el); if(ename == "mousewheel" && el.addEventListener){ el.removeEventListener("DOMMouseScroll", hd, false); } if(ename == "mousedown" && el == document){ Ext.EventManager.stoppedMouseDownEvent.removeListener(hd); } }; var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/; var pub = { addListener : function(element, eventName, fn, scope, options){ if(typeof eventName == "object"){ var o = eventName; for(var e in o){ if(propRe.test(e)){ continue; } if(typeof o[e] == "function"){ listen(element, e, o, o[e], o.scope); }else{ listen(element, e, o[e]); } } return; } return listen(element, eventName, options, fn, scope); }, removeListener : function(element, eventName, fn){ return stopListening(element, eventName, fn); }, onDocumentReady : function(fn, scope, options){ if(docReadyState){ docReadyEvent.addListener(fn, scope, options); docReadyEvent.fire(); docReadyEvent.clearListeners(); return; } if(!docReadyEvent){ initDocReady(); } docReadyEvent.addListener(fn, scope, options); }, onWindowResize : function(fn, scope, options){ if(!resizeEvent){ resizeEvent = new Ext.util.Event(); resizeTask = new Ext.util.DelayedTask(function(){ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); }); E.on(window, "resize", this.fireWindowResize, this); } resizeEvent.addListener(fn, scope, options); }, fireWindowResize : function(){ if(resizeEvent){ if((Ext.isIE||Ext.isAir) && resizeTask){ resizeTask.delay(50); }else{ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); } } }, onTextResize : function(fn, scope, options){ if(!textEvent){ textEvent = new Ext.util.Event(); var textEl = new Ext.Element(document.createElement('div')); textEl.dom.className = 'x-text-resize'; textEl.dom.innerHTML = 'X'; textEl.appendTo(document.body); textSize = textEl.dom.offsetHeight; setInterval(function(){ if(textEl.dom.offsetHeight != textSize){ textEvent.fire(textSize, textSize = textEl.dom.offsetHeight); } }, this.textResizeInterval); } textEvent.addListener(fn, scope, options); }, removeResizeListener : function(fn, scope){ if(resizeEvent){ resizeEvent.removeListener(fn, scope); } }, fireResize : function(){ if(resizeEvent){ resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); } }, ieDeferSrc : false, textResizeInterval : 50 }; pub.on = pub.addListener; pub.un = pub.removeListener; pub.stoppedMouseDownEvent = new Ext.util.Event(); return pub; }(); Ext.onReady = Ext.EventManager.onDocumentReady; Ext.onReady(function(){ var bd = Ext.getBody(); if(!bd){ return; } var cls = [ Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7') : Ext.isGecko ? "ext-gecko" : Ext.isOpera ? "ext-opera" : Ext.isSafari ? "ext-safari" : ""]; if(Ext.isMac){ cls.push("ext-mac"); } if(Ext.isLinux){ cls.push("ext-linux"); } if(Ext.isBorderBox){ cls.push('ext-border-box'); } if(Ext.isStrict){ var p = bd.dom.parentNode; if(p){ p.className += ' ext-strict'; } } bd.addClass(cls.join(' ')); }); Ext.EventObject = function(){ var E = Ext.lib.Event; var safariKeys = { 63234 : 37, 63235 : 39, 63232 : 38, 63233 : 40, 63276 : 33, 63277 : 34, 63272 : 46, 63273 : 36, 63275 : 35 }; var btnMap = Ext.isIE ? {1:0,4:1,2:2} : (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2}); Ext.EventObjectImpl = function(e){ if(e){ this.setEvent(e.browserEvent || e); } }; Ext.EventObjectImpl.prototype = { browserEvent : null, button : -1, shiftKey : false, ctrlKey : false, altKey : false, BACKSPACE : 8, TAB : 9, RETURN : 13, ENTER : 13, SHIFT : 16, CONTROL : 17, ESC : 27, SPACE : 32, PAGEUP : 33, PAGEDOWN : 34, END : 35, HOME : 36, LEFT : 37, UP : 38, RIGHT : 39, DOWN : 40, DELETE : 46, F5 : 116, setEvent : function(e){ if(e == this || (e && e.browserEvent)){ return e; } this.browserEvent = e; if(e){ this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1); if(e.type == 'click' && this.button == -1){ this.button = 0; } this.type = e.type; this.shiftKey = e.shiftKey; this.ctrlKey = e.ctrlKey || e.metaKey; this.altKey = e.altKey; this.keyCode = e.keyCode; this.charCode = e.charCode; this.target = E.getTarget(e); this.xy = E.getXY(e); }else{ this.button = -1; this.shiftKey = false; this.ctrlKey = false; this.altKey = false; this.keyCode = 0; this.charCode =0; this.target = null; this.xy = [0, 0]; } return this; }, stopEvent : function(){ if(this.browserEvent){ if(this.browserEvent.type == 'mousedown'){ Ext.EventManager.stoppedMouseDownEvent.fire(this); } E.stopEvent(this.browserEvent); } }, preventDefault : function(){ if(this.browserEvent){ E.preventDefault(this.browserEvent); } }, isNavKeyPress : function(){ var k = this.keyCode; k = Ext.isSafari ? (safariKeys[k] || k) : k; return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC; }, isSpecialKey : function(){ var k = this.keyCode; return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 || (k == 16) || (k == 17) || (k >= 18 && k <= 20) || (k >= 33 && k <= 35) || (k >= 36 && k <= 39) || (k >= 44 && k <= 45); }, stopPropagation : function(){ if(this.browserEvent){ if(this.browserEvent.type == 'mousedown'){ Ext.EventManager.stoppedMouseDownEvent.fire(this); } E.stopPropagation(this.browserEvent); } }, getCharCode : function(){ return this.charCode || this.keyCode; }, getKey : function(){ var k = this.keyCode || this.charCode; return Ext.isSafari ? (safariKeys[k] || k) : k; }, getPageX : function(){ return this.xy[0]; }, getPageY : function(){ return this.xy[1]; }, getTime : function(){ if(this.browserEvent){ return E.getTime(this.browserEvent); } return null; }, getXY : function(){ return this.xy; }, getTarget : function(selector, maxDepth, returnEl){ var t = Ext.get(this.target); return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target); }, getRelatedTarget : function(){ if(this.browserEvent){ return E.getRelatedTarget(this.browserEvent); } return null; }, getWheelDelta : function(){ var e = this.browserEvent; var delta = 0; if(e.wheelDelta){ delta = e.wheelDelta/120; }else if(e.detail){ delta = -e.detail/3; } return delta; }, hasModifier : function(){ return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false; }, within : function(el, related){ var t = this[related ? "getRelatedTarget" : "getTarget"](); return t && Ext.fly(el).contains(t); }, getPoint : function(){ return new Ext.lib.Point(this.xy[0], this.xy[1]); } }; return new Ext.EventObjectImpl(); }(); (function(){ var D = Ext.lib.Dom; var E = Ext.lib.Event; var A = Ext.lib.Anim; var propCache = {}; var camelRe = /(-[a-z])/gi; var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); }; var view = document.defaultView; Ext.Element = function(element, forceNew){ var dom = typeof element == "string" ? document.getElementById(element) : element; if(!dom){ return null; } var id = dom.id; if(forceNew !== true && id && Ext.Element.cache[id]){ return Ext.Element.cache[id]; } this.dom = dom; this.id = id || Ext.id(dom); }; var El = Ext.Element; El.prototype = { originalDisplay : "", visibilityMode : 1, defaultUnit : "px", setVisibilityMode : function(visMode){ this.visibilityMode = visMode; return this; }, enableDisplayMode : function(display){ this.setVisibilityMode(El.DISPLAY); if(typeof display != "undefined") this.originalDisplay = display; return this; }, findParent : function(simpleSelector, maxDepth, returnEl){ var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl; maxDepth = maxDepth || 50; if(typeof maxDepth != "number"){ stopEl = Ext.getDom(maxDepth); maxDepth = 10; } while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){ if(dq.is(p, simpleSelector)){ return returnEl ? Ext.get(p) : p; } depth++; p = p.parentNode; } return null; }, findParentNode : function(simpleSelector, maxDepth, returnEl){ var p = Ext.fly(this.dom.parentNode, '_internal'); return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null; }, up : function(simpleSelector, maxDepth){ return this.findParentNode(simpleSelector, maxDepth, true); }, is : function(simpleSelector){ return Ext.DomQuery.is(this.dom, simpleSelector); }, animate : function(args, duration, onComplete, easing, animType){ this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType); return this; }, anim : function(args, opt, animType, defaultDur, defaultEase, cb){ animType = animType || 'run'; opt = opt || {}; var anim = Ext.lib.Anim[animType]( this.dom, args, (opt.duration || defaultDur) || .35, (opt.easing || defaultEase) || 'easeOut', function(){ Ext.callback(cb, this); Ext.callback(opt.callback, opt.scope || this, [this, opt]); }, this ); opt.anim = anim; return anim; }, preanim : function(a, i){ return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]}); }, clean : function(forceReclean){ if(this.isCleaned && forceReclean !== true){ return this; } var ns = /\S/; var d = this.dom, n = d.firstChild, ni = -1; while(n){ var nx = n.nextSibling; if(n.nodeType == 3 && !ns.test(n.nodeValue)){ d.removeChild(n); }else{ n.nodeIndex = ++ni; } n = nx; } this.isCleaned = true; return this; }, scrollIntoView : function(container, hscroll){ var c = Ext.getDom(container) || Ext.getBody().dom; var el = this.dom; var o = this.getOffsetsTo(c), l = o[0] + c.scrollLeft, t = o[1] + c.scrollTop, b = t+el.offsetHeight, r = l+el.offsetWidth; var ch = c.clientHeight; var ct = parseInt(c.scrollTop, 10); var cl = parseInt(c.scrollLeft, 10); var cb = ct + ch; var cr = cl + c.clientWidth; if(el.offsetHeight > ch || t < ct){ c.scrollTop = t; }else if(b > cb){ c.scrollTop = b-ch; } c.scrollTop = c.scrollTop; if(hscroll !== false){ if(el.offsetWidth > c.clientWidth || l < cl){ c.scrollLeft = l; }else if(r > cr){ c.scrollLeft = r-c.clientWidth; } c.scrollLeft = c.scrollLeft; } return this; }, scrollChildIntoView : function(child, hscroll){ Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll); }, autoHeight : function(animate, duration, onComplete, easing){ var oldHeight = this.getHeight(); this.clip(); this.setHeight(1); setTimeout(function(){ var height = parseInt(this.dom.scrollHeight, 10); if(!animate){ this.setHeight(height); this.unclip(); if(typeof onComplete == "function"){ onComplete(); } }else{ this.setHeight(oldHeight); this.setHeight(height, animate, duration, function(){ this.unclip(); if(typeof onComplete == "function") onComplete(); }.createDelegate(this), easing); } }.createDelegate(this), 0); return this; }, contains : function(el){ if(!el){return false;} return D.isAncestor(this.dom, el.dom ? el.dom : el); }, isVisible : function(deep) { var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none"); if(deep !== true || !vis){ return vis; } var p = this.dom.parentNode; while(p && p.tagName.toLowerCase() != "body"){ if(!Ext.fly(p, '_isVisible').isVisible()){ return false; } p = p.parentNode; } return true; }, select : function(selector, unique){ return El.select(selector, unique, this.dom); }, query : function(selector, unique){ return Ext.DomQuery.select(selector, this.dom); }, child : function(selector, returnDom){ var n = Ext.DomQuery.selectNode(selector, this.dom); return returnDom ? n : Ext.get(n); }, down : function(selector, returnDom){ var n = Ext.DomQuery.selectNode(" > " + selector, this.dom); return returnDom ? n : Ext.get(n); }, initDD : function(group, config, overrides){ var dd = new Ext.dd.DD(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, initDDProxy : function(group, config, overrides){ var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, initDDTarget : function(group, config, overrides){ var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config); return Ext.apply(dd, overrides); }, setVisible : function(visible, animate){ if(!animate || !A){ if(this.visibilityMode == El.DISPLAY){ this.setDisplayed(visible); }else{ this.fixDisplay(); this.dom.style.visibility = visible ? "visible" : "hidden"; } }else{ var dom = this.dom; var visMode = this.visibilityMode; if(visible){ this.setOpacity(.01); this.setVisible(true); } this.anim({opacity: { to: (visible?1:0) }}, this.preanim(arguments, 1), null, .35, 'easeIn', function(){ if(!visible){ if(visMode == El.DISPLAY){ dom.style.display = "none"; }else{ dom.style.visibility = "hidden"; } Ext.get(dom).setOpacity(1); } }); } return this; }, isDisplayed : function() { return this.getStyle("display") != "none"; }, toggle : function(animate){ this.setVisible(!this.isVisible(), this.preanim(arguments, 0)); return this; }, setDisplayed : function(value) { if(typeof value == "boolean"){ value = value ? this.originalDisplay : "none"; } this.setStyle("display", value); return this; }, focus : function() { try{ this.dom.focus(); }catch(e){} return this; }, blur : function() { try{ this.dom.blur(); }catch(e){} return this; }, addClass : function(className){ if(Ext.isArray(className)){ for(var i = 0, len = className.length; i < len; i++) { this.addClass(className[i]); } }else{ if(className && !this.hasClass(className)){ this.dom.className = this.dom.className + " " + className; } } return this; }, radioClass : function(className){ var siblings = this.dom.parentNode.childNodes; for(var i = 0; i < siblings.length; i++) { var s = siblings[i]; if(s.nodeType == 1){ Ext.get(s).removeClass(className); } } this.addClass(className); return this; }, removeClass : function(className){ if(!className || !this.dom.className){ return this; } if(Ext.isArray(className)){ for(var i = 0, len = className.length; i < len; i++) { this.removeClass(className[i]); } }else{ if(this.hasClass(className)){ var re = this.classReCache[className]; if (!re) { re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g"); this.classReCache[className] = re; } this.dom.className = this.dom.className.replace(re, " "); } } return this; }, classReCache: {}, toggleClass : function(className){ if(this.hasClass(className)){ this.removeClass(className); }else{ this.addClass(className); } return this; }, hasClass : function(className){ return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1; }, replaceClass : function(oldClassName, newClassName){ this.removeClass(oldClassName); this.addClass(newClassName); return this; }, getStyles : function(){ var a = arguments, len = a.length, r = {}; for(var i = 0; i < len; i++){ r[a[i]] = this.getStyle(a[i]); } return r; }, getStyle : function(){ return view && view.getComputedStyle ? function(prop){ var el = this.dom, v, cs, camel; if(prop == 'float'){ prop = "cssFloat"; } if(v = el.style[prop]){ return v; } if(cs = view.getComputedStyle(el, "")){ if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } return cs[camel]; } return null; } : function(prop){ var el = this.dom, v, cs, camel; if(prop == 'opacity'){ if(typeof el.style.filter == 'string'){ var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i); if(m){ var fv = parseFloat(m[1]); if(!isNaN(fv)){ return fv ? fv / 100 : 0; } } } return 1; }else if(prop == 'float'){ prop = "styleFloat"; } if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } if(v = el.style[camel]){ return v; } if(cs = el.currentStyle){ return cs[camel]; } return null; }; }(), setStyle : function(prop, value){ if(typeof prop == "string"){ var camel; if(!(camel = propCache[prop])){ camel = propCache[prop] = prop.replace(camelRe, camelFn); } if(camel == 'opacity') { this.setOpacity(value); }else{ this.dom.style[camel] = value; } }else{ for(var style in prop){ if(typeof prop[style] != "function"){ this.setStyle(style, prop[style]); } } } return this; }, applyStyles : function(style){ Ext.DomHelper.applyStyles(this.dom, style); return this; }, getX : function(){ return D.getX(this.dom); }, getY : function(){ return D.getY(this.dom); }, getXY : function(){ return D.getXY(this.dom); }, getOffsetsTo : function(el){ var o = this.getXY(); var e = Ext.fly(el, '_internal').getXY(); return [o[0]-e[0],o[1]-e[1]]; }, setX : function(x, animate){ if(!animate || !A){ D.setX(this.dom, x); }else{ this.setXY([x, this.getY()], this.preanim(arguments, 1)); } return this; }, setY : function(y, animate){ if(!animate || !A){ D.setY(this.dom, y); }else{ this.setXY([this.getX(), y], this.preanim(arguments, 1)); } return this; }, setLeft : function(left){ this.setStyle("left", this.addUnits(left)); return this; }, setTop : function(top){ this.setStyle("top", this.addUnits(top)); return this; }, setRight : function(right){ this.setStyle("right", this.addUnits(right)); return this; }, setBottom : function(bottom){ this.setStyle("bottom", this.addUnits(bottom)); return this; }, setXY : function(pos, animate){ if(!animate || !A){ D.setXY(this.dom, pos); }else{ this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion'); } return this; }, setLocation : function(x, y, animate){ this.setXY([x, y], this.preanim(arguments, 2)); return this; }, moveTo : function(x, y, animate){ this.setXY([x, y], this.preanim(arguments, 2)); return this; }, getRegion : function(){ return D.getRegion(this.dom); }, getHeight : function(contentHeight){ var h = this.dom.offsetHeight || 0; h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb"); return h < 0 ? 0 : h; }, getWidth : function(contentWidth){ var w = this.dom.offsetWidth || 0; w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr"); return w < 0 ? 0 : w; }, getComputedHeight : function(){ var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight); if(!h){ h = parseInt(this.getStyle('height'), 10) || 0; if(!this.isBorderBox()){ h += this.getFrameWidth('tb'); } } return h; }, getComputedWidth : function(){ var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth); if(!w){ w = parseInt(this.getStyle('width'), 10) || 0; if(!this.isBorderBox()){ w += this.getFrameWidth('lr'); } } return w; }, getSize : function(contentSize){ return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)}; }, getStyleSize : function(){ var w, h, d = this.dom, s = d.style; if(s.width && s.width != 'auto'){ w = parseInt(s.width, 10); if(Ext.isBorderBox){ w -= this.getFrameWidth('lr'); } } if(s.height && s.height != 'auto'){ h = parseInt(s.height, 10); if(Ext.isBorderBox){ h -= this.getFrameWidth('tb'); } } return {width: w || this.getWidth(true), height: h || this.getHeight(true)}; }, getViewSize : function(){ var d = this.dom, doc = document, aw = 0, ah = 0; if(d == doc || d == doc.body){ return {width : D.getViewWidth(), height: D.getViewHeight()}; }else{ return { width : d.clientWidth, height: d.clientHeight }; } }, getValue : function(asNumber){ return asNumber ? parseInt(this.dom.value, 10) : this.dom.value; }, adjustWidth : function(width){ if(typeof width == "number"){ if(this.autoBoxAdjust && !this.isBorderBox()){ width -= (this.getBorderWidth("lr") + this.getPadding("lr")); } if(width < 0){ width = 0; } } return width; }, adjustHeight : function(height){ if(typeof height == "number"){ if(this.autoBoxAdjust && !this.isBorderBox()){ height -= (this.getBorderWidth("tb") + this.getPadding("tb")); } if(height < 0){ height = 0; } } return height; }, setWidth : function(width, animate){ width = this.adjustWidth(width); if(!animate || !A){ this.dom.style.width = this.addUnits(width); }else{ this.anim({width: {to: width}}, this.preanim(arguments, 1)); } return this; }, setHeight : function(height, animate){ height = this.adjustHeight(height); if(!animate || !A){ this.dom.style.height = this.addUnits(height); }else{ this.anim({height: {to: height}}, this.preanim(arguments, 1)); } return this; }, setSize : function(width, height, animate){ if(typeof width == "object"){ height = width.height; width = width.width; } width = this.adjustWidth(width); height = this.adjustHeight(height); if(!animate || !A){ this.dom.style.width = this.addUnits(width); this.dom.style.height = this.addUnits(height); }else{ this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2)); } return this; }, setBounds : function(x, y, width, height, animate){ if(!animate || !A){ this.setSize(width, height); this.setLocation(x, y); }else{ width = this.adjustWidth(width); height = this.adjustHeight(height); this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}}, this.preanim(arguments, 4), 'motion'); } return this; }, setRegion : function(region, animate){ this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1)); return this; }, addListener : function(eventName, fn, scope, options){ Ext.EventManager.on(this.dom, eventName, fn, scope || this, options); }, removeListener : function(eventName, fn){ Ext.EventManager.removeListener(this.dom, eventName, fn); return this; }, removeAllListeners : function(){ E.purgeElement(this.dom); return this; }, relayEvent : function(eventName, observable){ this.on(eventName, function(e){ observable.fireEvent(eventName, e); }); }, setOpacity : function(opacity, animate){ if(!animate || !A){ var s = this.dom.style; if(Ext.isIE){ s.zoom = 1; s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") + (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")"); }else{ s.opacity = opacity; } }else{ this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn'); } return this; }, getLeft : function(local){ if(!local){ return this.getX(); }else{ return parseInt(this.getStyle("left"), 10) || 0; } }, getRight : function(local){ if(!local){ return this.getX() + this.getWidth(); }else{ return (this.getLeft(true) + this.getWidth()) || 0; } }, getTop : function(local) { if(!local){ return this.getY(); }else{ return parseInt(this.getStyle("top"), 10) || 0; } }, getBottom : function(local){ if(!local){ return this.getY() + this.getHeight(); }else{ return (this.getTop(true) + this.getHeight()) || 0; } }, position : function(pos, zIndex, x, y){ if(!pos){ if(this.getStyle('position') == 'static'){ this.setStyle('position', 'relative'); } }else{ this.setStyle("position", pos); } if(zIndex){ this.setStyle("z-index", zIndex); } if(x !== undefined && y !== undefined){ this.setXY([x, y]); }else if(x !== undefined){ this.setX(x); }else if(y !== undefined){ this.setY(y); } }, clearPositioning : function(value){ value = value ||''; this.setStyle({ "left": value, "right": value, "top": value, "bottom": value, "z-index": "", "position" : "static" }); return this; }, getPositioning : function(){ var l = this.getStyle("left"); var t = this.getStyle("top"); return { "position" : this.getStyle("position"), "left" : l, "right" : l ? "" : this.getStyle("right"), "top" : t, "bottom" : t ? "" : this.getStyle("bottom"), "z-index" : this.getStyle("z-index") }; }, getBorderWidth : function(side){ return this.addStyles(side, El.borders); }, getPadding : function(side){ return this.addStyles(side, El.paddings); }, setPositioning : function(pc){ this.applyStyles(pc); if(pc.right == "auto"){ this.dom.style.right = ""; } if(pc.bottom == "auto"){ this.dom.style.bottom = ""; } return this; }, fixDisplay : function(){ if(this.getStyle("display") == "none"){ this.setStyle("visibility", "hidden"); this.setStyle("display", this.originalDisplay); if(this.getStyle("display") == "none"){ this.setStyle("display", "block"); } } }, setOverflow : function(v){ if(v=='auto' && Ext.isMac && Ext.isGecko){ this.dom.style.overflow = 'hidden'; (function(){this.dom.style.overflow = 'auto';}).defer(1, this); }else{ this.dom.style.overflow = v; } }, setLeftTop : function(left, top){ this.dom.style.left = this.addUnits(left); this.dom.style.top = this.addUnits(top); return this; }, move : function(direction, distance, animate){ var xy = this.getXY(); direction = direction.toLowerCase(); switch(direction){ case "l": case "left": this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2)); break; case "r": case "right": this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2)); break; case "t": case "top": case "up": this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2)); break; case "b": case "bottom": case "down": this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2)); break; } return this; }, clip : function(){ if(!this.isClipped){ this.isClipped = true; this.originalClip = { "o": this.getStyle("overflow"), "x": this.getStyle("overflow-x"), "y": this.getStyle("overflow-y") }; this.setStyle("overflow", "hidden"); this.setStyle("overflow-x", "hidden"); this.setStyle("overflow-y", "hidden"); } return this; }, unclip : function(){ if(this.isClipped){ this.isClipped = false; var o = this.originalClip; if(o.o){this.setStyle("overflow", o.o);} if(o.x){this.setStyle("overflow-x", o.x);} if(o.y){this.setStyle("overflow-y", o.y);} } return this; }, getAnchorXY : function(anchor, local, s){ var w, h, vp = false; if(!s){ var d = this.dom; if(d == document.body || d == document){ vp = true; w = D.getViewWidth(); h = D.getViewHeight(); }else{ w = this.getWidth(); h = this.getHeight(); } }else{ w = s.width; h = s.height; } var x = 0, y = 0, r = Math.round; switch((anchor || "tl").toLowerCase()){ case "c": x = r(w*.5); y = r(h*.5); break; case "t": x = r(w*.5); y = 0; break; case "l": x = 0; y = r(h*.5); break; case "r": x = w; y = r(h*.5); break; case "b": x = r(w*.5); y = h; break; case "tl": x = 0; y = 0; break; case "bl": x = 0; y = h; break; case "br": x = w; y = h; break; case "tr": x = w; y = 0; break; } if(local === true){ return [x, y]; } if(vp){ var sc = this.getScroll(); return [x + sc.left, y + sc.top]; } var o = this.getXY(); return [x+o[0], y+o[1]]; }, getAlignToXY : function(el, p, o){ el = Ext.get(el); if(!el || !el.dom){ throw "Element.alignToXY with an element that doesn't exist"; } var d = this.dom; var c = false; var p1 = "", p2 = ""; o = o || [0,0]; if(!p){ p = "tl-bl"; }else if(p == "?"){ p = "tl-bl?"; }else if(p.indexOf("-") == -1){ p = "tl-" + p; } p = p.toLowerCase(); var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/); if(!m){ throw "Element.alignTo with an invalid alignment " + p; } p1 = m[1]; p2 = m[2]; c = !!m[3]; var a1 = this.getAnchorXY(p1, true); var a2 = el.getAnchorXY(p2, false); var x = a2[0] - a1[0] + o[0]; var y = a2[1] - a1[1] + o[1]; if(c){ var w = this.getWidth(), h = this.getHeight(), r = el.getRegion(); var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5; var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1); var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1); var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t")); var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r")); var doc = document; var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5; var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5; if((x+w) > dw + scrollX){ x = swapX ? r.left-w : dw+scrollX-w; } if(x < scrollX){ x = swapX ? r.right : scrollX; } if((y+h) > dh + scrollY){ y = swapY ? r.top-h : dh+scrollY-h; } if (y < scrollY){ y = swapY ? r.bottom : scrollY; } } return [x,y]; }, getConstrainToXY : function(){ var os = {top:0, left:0, bottom:0, right: 0}; return function(el, local, offsets, proposedXY){ el = Ext.get(el); offsets = offsets ? Ext.applyIf(offsets, os) : os; var vw, vh, vx = 0, vy = 0; if(el.dom == document.body || el.dom == document){ vw = Ext.lib.Dom.getViewWidth(); vh = Ext.lib.Dom.getViewHeight(); }else{ vw = el.dom.clientWidth; vh = el.dom.clientHeight; if(!local){ var vxy = el.getXY(); vx = vxy[0]; vy = vxy[1]; } } var s = el.getScroll(); vx += offsets.left + s.left; vy += offsets.top + s.top; vw -= offsets.right; vh -= offsets.bottom; var vr = vx+vw; var vb = vy+vh; var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]); var x = xy[0], y = xy[1]; var w = this.dom.offsetWidth, h = this.dom.offsetHeight; var moved = false; if((x + w) > vr){ x = vr - w; moved = true; } if((y + h) > vb){ y = vb - h; moved = true; } if(x < vx){ x = vx; moved = true; } if(y < vy){ y = vy; moved = true; } return moved ? [x, y] : false; }; }(), adjustForConstraints : function(xy, parent, offsets){ return this.getConstrainToXY(parent || document, false, offsets, xy) || xy; }, alignTo : function(element, position, offsets, animate){ var xy = this.getAlignToXY(element, position, offsets); this.setXY(xy, this.preanim(arguments, 3)); return this; }, anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){ var action = function(){ this.alignTo(el, alignment, offsets, animate); Ext.callback(callback, this); }; Ext.EventManager.onWindowResize(action, this); var tm = typeof monitorScroll; if(tm != 'undefined'){ Ext.EventManager.on(window, 'scroll', action, this, {buffer: tm == 'number' ? monitorScroll : 50}); } action.call(this); return this; }, clearOpacity : function(){ if (window.ActiveXObject) { if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){ this.dom.style.filter = ""; } } else { this.dom.style.opacity = ""; this.dom.style["-moz-opacity"] = ""; this.dom.style["-khtml-opacity"] = ""; } return this; }, hide : function(animate){ this.setVisible(false, this.preanim(arguments, 0)); return this; }, show : function(animate){ this.setVisible(true, this.preanim(arguments, 0)); return this; }, addUnits : function(size){ return Ext.Element.addUnits(size, this.defaultUnit); }, update : function(html, loadScripts, callback){ if(typeof html == "undefined"){ html = ""; } if(loadScripts !== true){ this.dom.innerHTML = html; if(typeof callback == "function"){ callback(); } return this; } var id = Ext.id(); var dom = this.dom; html += '<span id="' + id + '"></span>'; E.onAvailable(id, function(){ var hd = document.getElementsByTagName("head")[0]; var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig; var srcRe = /\ssrc=([\'\"])(.*?)\1/i; var typeRe = /\stype=([\'\"])(.*?)\1/i; var match; while(match = re.exec(html)){ var attrs = match[1]; var srcMatch = attrs ? attrs.match(srcRe) : false; if(srcMatch && srcMatch[2]){ var s = document.createElement("script"); s.src = srcMatch[2]; var typeMatch = attrs.match(typeRe); if(typeMatch && typeMatch[2]){ s.type = typeMatch[2]; } hd.appendChild(s); }else if(match[2] && match[2].length > 0){ if(window.execScript) { window.execScript(match[2]); } else { window.eval(match[2]); } } } var el = document.getElementById(id); if(el){Ext.removeNode(el);} if(typeof callback == "function"){ callback(); } }); dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, ""); return this; }, load : function(){ var um = this.getUpdater(); um.update.apply(um, arguments); return this; }, getUpdater : function(){ if(!this.updateManager){ this.updateManager = new Ext.Updater(this); } return this.updateManager; }, unselectable : function(){ this.dom.unselectable = "on"; this.swallowEvent("selectstart", true); this.applyStyles("-moz-user-select:none;-khtml-user-select:none;"); this.addClass("x-unselectable"); return this; }, getCenterXY : function(){ return this.getAlignToXY(document, 'c-c'); }, center : function(centerIn){ this.alignTo(centerIn || document, 'c-c'); return this; }, isBorderBox : function(){ return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox; }, getBox : function(contentBox, local){ var xy; if(!local){ xy = this.getXY(); }else{ var left = parseInt(this.getStyle("left"), 10) || 0; var top = parseInt(this.getStyle("top"), 10) || 0; xy = [left, top]; } var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx; if(!contentBox){ bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h}; }else{ var l = this.getBorderWidth("l")+this.getPadding("l"); var r = this.getBorderWidth("r")+this.getPadding("r"); var t = this.getBorderWidth("t")+this.getPadding("t"); var b = this.getBorderWidth("b")+this.getPadding("b"); bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)}; } bx.right = bx.x + bx.width; bx.bottom = bx.y + bx.height; return bx; }, getFrameWidth : function(sides, onlyContentBox){ return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides)); }, setBox : function(box, adjust, animate){ var w = box.width, h = box.height; if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){ w -= (this.getBorderWidth("lr") + this.getPadding("lr")); h -= (this.getBorderWidth("tb") + this.getPadding("tb")); } this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2)); return this; }, repaint : function(){ var dom = this.dom; this.addClass("x-repaint"); setTimeout(function(){ Ext.get(dom).removeClass("x-repaint"); }, 1); return this; }, getMargins : function(side){ if(!side){ return { top: parseInt(this.getStyle("margin-top"), 10) || 0, left: parseInt(this.getStyle("margin-left"), 10) || 0, bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0, right: parseInt(this.getStyle("margin-right"), 10) || 0 }; }else{ return this.addStyles(side, El.margins); } }, addStyles : function(sides, styles){ var val = 0, v, w; for(var i = 0, len = sides.length; i < len; i++){ v = this.getStyle(styles[sides.charAt(i)]); if(v){ w = parseInt(v, 10); if(w){ val += (w >= 0 ? w : -1 * w); } } } return val; }, createProxy : function(config, renderTo, matchBox){ config = typeof config == "object" ? config : {tag : "div", cls: config}; var proxy; if(renderTo){ proxy = Ext.DomHelper.append(renderTo, config, true); }else { proxy = Ext.DomHelper.insertBefore(this.dom, config, true); } if(matchBox){ proxy.setBox(this.getBox()); } return proxy; }, mask : function(msg, msgCls){ if(this.getStyle("position") == "static"){ this.setStyle("position", "relative"); } if(this._maskMsg){ this._maskMsg.remove(); } if(this._mask){ this._mask.remove(); } this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true); this.addClass("x-masked"); this._mask.setDisplayed(true); if(typeof msg == 'string'){ this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true); var mm = this._maskMsg; mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg"; mm.dom.firstChild.innerHTML = msg; mm.setDisplayed(true); mm.center(this); } if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ this._mask.setSize(this.dom.clientWidth, this.getHeight()); } return this._mask; }, unmask : function(){ if(this._mask){ if(this._maskMsg){ this._maskMsg.remove(); delete this._maskMsg; } this._mask.remove(); delete this._mask; } this.removeClass("x-masked"); }, isMasked : function(){ return this._mask && this._mask.isVisible(); }, createShim : function(){ var el = document.createElement('iframe'); el.frameBorder = 'no'; el.className = 'ext-shim'; if(Ext.isIE && Ext.isSecure){ el.src = Ext.SSL_SECURE_URL; } var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom)); shim.autoBoxAdjust = false; return shim; }, remove : function(){ Ext.removeNode(this.dom); delete El.cache[this.dom.id]; }, hover : function(overFn, outFn, scope){ var preOverFn = function(e){ if(!e.within(this, true)){ overFn.apply(scope || this, arguments); } }; var preOutFn = function(e){ if(!e.within(this, true)){ outFn.apply(scope || this, arguments); } }; this.on("mouseover", preOverFn, this.dom); this.on("mouseout", preOutFn, this.dom); return this; }, addClassOnOver : function(className, preventFlicker){ this.hover( function(){ Ext.fly(this, '_internal').addClass(className); }, function(){ Ext.fly(this, '_internal').removeClass(className); } ); return this; }, addClassOnFocus : function(className){ this.on("focus", function(){ Ext.fly(this, '_internal').addClass(className); }, this.dom); this.on("blur", function(){ Ext.fly(this, '_internal').removeClass(className); }, this.dom); return this; }, addClassOnClick : function(className){ var dom = this.dom; this.on("mousedown", function(){ Ext.fly(dom, '_internal').addClass(className); var d = Ext.getDoc(); var fn = function(){ Ext.fly(dom, '_internal').removeClass(className); d.removeListener("mouseup", fn); }; d.on("mouseup", fn); }); return this; }, swallowEvent : function(eventName, preventDefault){ var fn = function(e){ e.stopPropagation(); if(preventDefault){ e.preventDefault(); } }; if(Ext.isArray(eventName)){ for(var i = 0, len = eventName.length; i < len; i++){ this.on(eventName[i], fn); } return this; } this.on(eventName, fn); return this; }, parent : function(selector, returnDom){ return this.matchNode('parentNode', 'parentNode', selector, returnDom); }, next : function(selector, returnDom){ return this.matchNode('nextSibling', 'nextSibling', selector, returnDom); }, prev : function(selector, returnDom){ return this.matchNode('previousSibling', 'previousSibling', selector, returnDom); }, first : function(selector, returnDom){ return this.matchNode('nextSibling', 'firstChild', selector, returnDom); }, last : function(selector, returnDom){ return this.matchNode('previousSibling', 'lastChild', selector, returnDom); }, matchNode : function(dir, start, selector, returnDom){ var n = this.dom[start]; while(n){ if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){ return !returnDom ? Ext.get(n) : n; } n = n[dir]; } return null; }, appendChild: function(el){ el = Ext.get(el); el.appendTo(this); return this; }, createChild: function(config, insertBefore, returnDom){ config = config || {tag:'div'}; if(insertBefore){ return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true); } return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true); }, appendTo: function(el){ el = Ext.getDom(el); el.appendChild(this.dom); return this; }, insertBefore: function(el){ el = Ext.getDom(el); el.parentNode.insertBefore(this.dom, el); return this; }, insertAfter: function(el){ el = Ext.getDom(el); el.parentNode.insertBefore(this.dom, el.nextSibling); return this; }, insertFirst: function(el, returnDom){ el = el || {}; if(typeof el == 'object' && !el.nodeType && !el.dom){ return this.createChild(el, this.dom.firstChild, returnDom); }else{ el = Ext.getDom(el); this.dom.insertBefore(el, this.dom.firstChild); return !returnDom ? Ext.get(el) : el; } }, insertSibling: function(el, where, returnDom){ var rt; if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++){ rt = this.insertSibling(el[i], where, returnDom); } return rt; } where = where ? where.toLowerCase() : 'before'; el = el || {}; var refNode = where == 'before' ? this.dom : this.dom.nextSibling; if(typeof el == 'object' && !el.nodeType && !el.dom){ if(where == 'after' && !this.dom.nextSibling){ rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom); }else{ rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom); } }else{ rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode); if(!returnDom){ rt = Ext.get(rt); } } return rt; }, wrap: function(config, returnDom){ if(!config){ config = {tag: "div"}; } var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom); newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom); return newEl; }, replace: function(el){ el = Ext.get(el); this.insertBefore(el); el.remove(); return this; }, replaceWith: function(el){ if(typeof el == 'object' && !el.nodeType && !el.dom){ el = this.insertSibling(el, 'before'); }else{ el = Ext.getDom(el); this.dom.parentNode.insertBefore(el, this.dom); } El.uncache(this.id); this.dom.parentNode.removeChild(this.dom); this.dom = el; this.id = Ext.id(el); El.cache[this.id] = this; return this; }, insertHtml : function(where, html, returnEl){ var el = Ext.DomHelper.insertHtml(where, this.dom, html); return returnEl ? Ext.get(el) : el; }, set : function(o, useSet){ var el = this.dom; useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet; for(var attr in o){ if(attr == "style" || typeof o[attr] == "function") continue; if(attr=="cls"){ el.className = o["cls"]; }else if(o.hasOwnProperty(attr)){ if(useSet) el.setAttribute(attr, o[attr]); else el[attr] = o[attr]; } } if(o.style){ Ext.DomHelper.applyStyles(el, o.style); } return this; }, addKeyListener : function(key, fn, scope){ var config; if(typeof key != "object" || Ext.isArray(key)){ config = { key: key, fn: fn, scope: scope }; }else{ config = { key : key.key, shift : key.shift, ctrl : key.ctrl, alt : key.alt, fn: fn, scope: scope }; } return new Ext.KeyMap(this, config); }, addKeyMap : function(config){ return new Ext.KeyMap(this, config); }, isScrollable : function(){ var dom = this.dom; return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth; }, scrollTo : function(side, value, animate){ var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop"; if(!animate || !A){ this.dom[prop] = value; }else{ var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value]; this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll'); } return this; }, scroll : function(direction, distance, animate){ if(!this.isScrollable()){ return; } var el = this.dom; var l = el.scrollLeft, t = el.scrollTop; var w = el.scrollWidth, h = el.scrollHeight; var cw = el.clientWidth, ch = el.clientHeight; direction = direction.toLowerCase(); var scrolled = false; var a = this.preanim(arguments, 2); switch(direction){ case "l": case "left": if(w - l > cw){ var v = Math.min(l + distance, w-cw); this.scrollTo("left", v, a); scrolled = true; } break; case "r": case "right": if(l > 0){ var v = Math.max(l - distance, 0); this.scrollTo("left", v, a); scrolled = true; } break; case "t": case "top": case "up": if(t > 0){ var v = Math.max(t - distance, 0); this.scrollTo("top", v, a); scrolled = true; } break; case "b": case "bottom": case "down": if(h - t > ch){ var v = Math.min(t + distance, h-ch); this.scrollTo("top", v, a); scrolled = true; } break; } return scrolled; }, translatePoints : function(x, y){ if(typeof x == 'object' || Ext.isArray(x)){ y = x[1]; x = x[0]; } var p = this.getStyle('position'); var o = this.getXY(); var l = parseInt(this.getStyle('left'), 10); var t = parseInt(this.getStyle('top'), 10); if(isNaN(l)){ l = (p == "relative") ? 0 : this.dom.offsetLeft; } if(isNaN(t)){ t = (p == "relative") ? 0 : this.dom.offsetTop; } return {left: (x - o[0] + l), top: (y - o[1] + t)}; }, getScroll : function(){ var d = this.dom, doc = document; if(d == doc || d == doc.body){ var l, t; if(Ext.isIE && Ext.isStrict){ l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0); t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0); }else{ l = window.pageXOffset || (doc.body.scrollLeft || 0); t = window.pageYOffset || (doc.body.scrollTop || 0); } return {left: l, top: t}; }else{ return {left: d.scrollLeft, top: d.scrollTop}; } }, getColor : function(attr, defaultValue, prefix){ var v = this.getStyle(attr); if(!v || v == "transparent" || v == "inherit") { return defaultValue; } var color = typeof prefix == "undefined" ? "#" : prefix; if(v.substr(0, 4) == "rgb("){ var rvs = v.slice(4, v.length -1).split(","); for(var i = 0; i < 3; i++){ var h = parseInt(rvs[i]); var s = h.toString(16); if(h < 16){ s = "0" + s; } color += s; } } else { if(v.substr(0, 1) == "#"){ if(v.length == 4) { for(var i = 1; i < 4; i++){ var c = v.charAt(i); color += c + c; } }else if(v.length == 7){ color += v.substr(1); } } } return(color.length > 5 ? color.toLowerCase() : defaultValue); }, boxWrap : function(cls){ cls = cls || 'x-box'; var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls))); el.child('.'+cls+'-mc').dom.appendChild(this.dom); return el; }, getAttributeNS : Ext.isIE ? function(ns, name){ var d = this.dom; var type = typeof d[ns+":"+name]; if(type != 'undefined' && type != 'unknown'){ return d[ns+":"+name]; } return d[name]; } : function(ns, name){ var d = this.dom; return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name]; }, getTextWidth : function(text, min, max){ return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000); } }; var ep = El.prototype; ep.on = ep.addListener; ep.mon = ep.addListener; ep.getUpdateManager = ep.getUpdater; ep.un = ep.removeListener; ep.autoBoxAdjust = true; El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i; El.addUnits = function(v, defaultUnit){ if(v === "" || v == "auto"){ return v; } if(v === undefined){ return ''; } if(typeof v == "number" || !El.unitPattern.test(v)){ return v + (defaultUnit || 'px'); } return v; }; El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>'; El.VISIBILITY = 1; El.DISPLAY = 2; El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"}; El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"}; El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"}; El.cache = {}; var docEl; El.get = function(el){ var ex, elm, id; if(!el){ return null; } if(typeof el == "string"){ if(!(elm = document.getElementById(el))){ return null; } if(ex = El.cache[el]){ ex.dom = elm; }else{ ex = El.cache[el] = new El(elm); } return ex; }else if(el.tagName){ if(!(id = el.id)){ id = Ext.id(el); } if(ex = El.cache[id]){ ex.dom = el; }else{ ex = El.cache[id] = new El(el); } return ex; }else if(el instanceof El){ if(el != docEl){ el.dom = document.getElementById(el.id) || el.dom; El.cache[el.id] = el; } return el; }else if(el.isComposite){ return el; }else if(Ext.isArray(el)){ return El.select(el); }else if(el == document){ if(!docEl){ var f = function(){}; f.prototype = El.prototype; docEl = new f(); docEl.dom = document; } return docEl; } return null; }; El.uncache = function(el){ for(var i = 0, a = arguments, len = a.length; i < len; i++) { if(a[i]){ delete El.cache[a[i].id || a[i]]; } } }; El.garbageCollect = function(){ if(!Ext.enableGarbageCollector){ clearInterval(El.collectorThread); return; } for(var eid in El.cache){ var el = El.cache[eid], d = el.dom; if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){ delete El.cache[eid]; if(d && Ext.enableListenerCollection){ E.purgeElement(d); } } } } El.collectorThreadId = setInterval(El.garbageCollect, 30000); var flyFn = function(){}; flyFn.prototype = El.prototype; var _cls = new flyFn(); El.Flyweight = function(dom){ this.dom = dom; }; El.Flyweight.prototype = _cls; El.Flyweight.prototype.isFlyweight = true; El._flyweights = {}; El.fly = function(el, named){ named = named || '_global'; el = Ext.getDom(el); if(!el){ return null; } if(!El._flyweights[named]){ El._flyweights[named] = new El.Flyweight(); } El._flyweights[named].dom = el; return El._flyweights[named]; }; Ext.get = El.get; Ext.fly = El.fly; var noBoxAdjust = Ext.isStrict ? { select:1 } : { input:1, select:1, textarea:1 }; if(Ext.isIE || Ext.isGecko){ noBoxAdjust['button'] = 1; } Ext.EventManager.on(window, 'unload', function(){ delete El.cache; delete El._flyweights; }); })(); Ext.enableFx = true; Ext.Fx = { slideIn : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "t"; this.fixDisplay(); var r = this.getFxRestore(); var b = this.getBox(); this.setSize(b); var wrap = this.fxWrap(r.pos, o, "hidden"); var st = this.dom.style; st.visibility = "visible"; st.position = "absolute"; var after = function(){ el.fxUnwrap(wrap, r.pos, o); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height}; switch(anchor.toLowerCase()){ case "t": wrap.setSize(b.width, 0); st.left = st.bottom = "0"; a = {height: bh}; break; case "l": wrap.setSize(0, b.height); st.right = st.top = "0"; a = {width: bw}; break; case "r": wrap.setSize(0, b.height); wrap.setX(b.right); st.left = st.top = "0"; a = {width: bw, points: pt}; break; case "b": wrap.setSize(b.width, 0); wrap.setY(b.bottom); st.left = st.top = "0"; a = {height: bh, points: pt}; break; case "tl": wrap.setSize(0, 0); st.right = st.bottom = "0"; a = {width: bw, height: bh}; break; case "bl": wrap.setSize(0, 0); wrap.setY(b.y+b.height); st.right = st.top = "0"; a = {width: bw, height: bh, points: pt}; break; case "br": wrap.setSize(0, 0); wrap.setXY([b.right, b.bottom]); st.left = st.top = "0"; a = {width: bw, height: bh, points: pt}; break; case "tr": wrap.setSize(0, 0); wrap.setX(b.x+b.width); st.left = st.bottom = "0"; a = {width: bw, height: bh, points: pt}; break; } this.dom.style.visibility = "visible"; wrap.show(); arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5, 'easeOut', after); }); return this; }, slideOut : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "t"; var r = this.getFxRestore(); var b = this.getBox(); this.setSize(b); var wrap = this.fxWrap(r.pos, o, "visible"); var st = this.dom.style; st.visibility = "visible"; st.position = "absolute"; wrap.setSize(b); var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.fxUnwrap(wrap, r.pos, o); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a, zero = {to: 0}; switch(anchor.toLowerCase()){ case "t": st.left = st.bottom = "0"; a = {height: zero}; break; case "l": st.right = st.top = "0"; a = {width: zero}; break; case "r": st.left = st.top = "0"; a = {width: zero, points: {to:[b.right, b.y]}}; break; case "b": st.left = st.top = "0"; a = {height: zero, points: {to:[b.x, b.bottom]}}; break; case "tl": st.right = st.bottom = "0"; a = {width: zero, height: zero}; break; case "bl": st.right = st.top = "0"; a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}}; break; case "br": st.left = st.top = "0"; a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}}; break; case "tr": st.left = st.bottom = "0"; a = {width: zero, height: zero, points: {to:[b.right, b.y]}}; break; } arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5, "easeOut", after); }); return this; }, puff : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.clearOpacity(); this.show(); var r = this.getFxRestore(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; st.fontSize = ''; el.afterFx(o); }; var width = this.getWidth(); var height = this.getHeight(); arguments.callee.anim = this.fxanim({ width : {to: this.adjustWidth(width * 2)}, height : {to: this.adjustHeight(height * 2)}, points : {by: [-(width * .5), -(height * .5)]}, opacity : {to: 0}, fontSize: {to:200, unit: "%"} }, o, 'motion', .5, "easeOut", after); }); return this; }, switchOff : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.clearOpacity(); this.clip(); var r = this.getFxRestore(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; el.afterFx(o); }; this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){ this.clearOpacity(); (function(){ this.fxanim({ height:{to:1}, points:{by:[0, this.getHeight() * .5]} }, o, 'motion', 0.3, 'easeIn', after); }).defer(100, this); }); }); return this; }, highlight : function(color, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ color = color || "ffff9c"; var attr = o.attr || "backgroundColor"; this.clearOpacity(); this.show(); var origColor = this.getColor(attr); var restoreColor = this.dom.style[attr]; var endColor = (o.endColor || origColor) || "ffffff"; var after = function(){ el.dom.style[attr] = restoreColor; el.afterFx(o); }; var a = {}; a[attr] = {from: color, to: endColor}; arguments.callee.anim = this.fxanim(a, o, 'color', 1, 'easeIn', after); }); return this; }, frame : function(color, count, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ color = color || "#C3DAF9"; if(color.length == 6){ color = "#" + color; } count = count || 1; var duration = o.duration || 1; this.show(); var b = this.getBox(); var animFn = function(){ var proxy = Ext.getBody().createChild({ style:{ visbility:"hidden", position:"absolute", "z-index":"35000", border:"0px solid " + color } }); var scale = Ext.isBorderBox ? 2 : 1; proxy.animate({ top:{from:b.y, to:b.y - 20}, left:{from:b.x, to:b.x - 20}, borderWidth:{from:0, to:10}, opacity:{from:1, to:0}, height:{from:b.height, to:(b.height + (20*scale))}, width:{from:b.width, to:(b.width + (20*scale))} }, duration, function(){ proxy.remove(); if(--count > 0){ animFn(); }else{ el.afterFx(o); } }); }; animFn.call(this); }); return this; }, pause : function(seconds){ var el = this.getFxEl(); var o = {}; el.queueFx(o, function(){ setTimeout(function(){ el.afterFx(o); }, seconds * 1000); }); return this; }, fadeIn : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ this.setOpacity(0); this.fixDisplay(); this.dom.style.visibility = 'visible'; var to = o.endOpacity || 1; arguments.callee.anim = this.fxanim({opacity:{to:to}}, o, null, .5, "easeOut", function(){ if(to == 1){ this.clearOpacity(); } el.afterFx(o); }); }); return this; }, fadeOut : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}}, o, null, .5, "easeOut", function(){ if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){ this.dom.style.display = "none"; }else{ this.dom.style.visibility = "hidden"; } this.clearOpacity(); el.afterFx(o); }); }); return this; }, scale : function(w, h, o){ this.shift(Ext.apply({}, o, { width: w, height: h })); return this; }, shift : function(o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity; if(w !== undefined){ a.width = {to: this.adjustWidth(w)}; } if(h !== undefined){ a.height = {to: this.adjustHeight(h)}; } if(x !== undefined || y !== undefined){ a.points = {to: [ x !== undefined ? x : this.getX(), y !== undefined ? y : this.getY() ]}; } if(op !== undefined){ a.opacity = {to: op}; } if(o.xy !== undefined){ a.points = {to: o.xy}; } arguments.callee.anim = this.fxanim(a, o, 'motion', .35, "easeOut", function(){ el.afterFx(o); }); }); return this; }, ghost : function(anchor, o){ var el = this.getFxEl(); o = o || {}; el.queueFx(o, function(){ anchor = anchor || "b"; var r = this.getFxRestore(); var w = this.getWidth(), h = this.getHeight(); var st = this.dom.style; var after = function(){ if(o.useDisplay){ el.setDisplayed(false); }else{ el.hide(); } el.clearOpacity(); el.setPositioning(r.pos); st.width = r.width; st.height = r.height; el.afterFx(o); }; var a = {opacity: {to: 0}, points: {}}, pt = a.points; switch(anchor.toLowerCase()){ case "t": pt.by = [0, -h]; break; case "l": pt.by = [-w, 0]; break; case "r": pt.by = [w, 0]; break; case "b": pt.by = [0, h]; break; case "tl": pt.by = [-w, -h]; break; case "bl": pt.by = [-w, h]; break; case "br": pt.by = [w, h]; break; case "tr": pt.by = [w, -h]; break; } arguments.callee.anim = this.fxanim(a, o, 'motion', .5, "easeOut", after); }); return this; }, syncFx : function(){ this.fxDefaults = Ext.apply(this.fxDefaults || {}, { block : false, concurrent : true, stopFx : false }); return this; }, sequenceFx : function(){ this.fxDefaults = Ext.apply(this.fxDefaults || {}, { block : false, concurrent : false, stopFx : false }); return this; }, nextFx : function(){ var ef = this.fxQueue[0]; if(ef){ ef.call(this); } }, hasActiveFx : function(){ return this.fxQueue && this.fxQueue[0]; }, stopFx : function(){ if(this.hasActiveFx()){ var cur = this.fxQueue[0]; if(cur && cur.anim && cur.anim.isAnimated()){ this.fxQueue = [cur]; cur.anim.stop(true); } } return this; }, beforeFx : function(o){ if(this.hasActiveFx() && !o.concurrent){ if(o.stopFx){ this.stopFx(); return true; } return false; } return true; }, hasFxBlock : function(){ var q = this.fxQueue; return q && q[0] && q[0].block; }, queueFx : function(o, fn){ if(!this.fxQueue){ this.fxQueue = []; } if(!this.hasFxBlock()){ Ext.applyIf(o, this.fxDefaults); if(!o.concurrent){ var run = this.beforeFx(o); fn.block = o.block; this.fxQueue.push(fn); if(run){ this.nextFx(); } }else{ fn.call(this); } } return this; }, fxWrap : function(pos, o, vis){ var wrap; if(!o.wrap || !(wrap = Ext.get(o.wrap))){ var wrapXY; if(o.fixPosition){ wrapXY = this.getXY(); } var div = document.createElement("div"); div.style.visibility = vis; wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom)); wrap.setPositioning(pos); if(wrap.getStyle("position") == "static"){ wrap.position("relative"); } this.clearPositioning('auto'); wrap.clip(); wrap.dom.appendChild(this.dom); if(wrapXY){ wrap.setXY(wrapXY); } } return wrap; }, fxUnwrap : function(wrap, pos, o){ this.clearPositioning(); this.setPositioning(pos); if(!o.wrap){ wrap.dom.parentNode.insertBefore(this.dom, wrap.dom); wrap.remove(); } }, getFxRestore : function(){ var st = this.dom.style; return {pos: this.getPositioning(), width: st.width, height : st.height}; }, afterFx : function(o){ if(o.afterStyle){ this.applyStyles(o.afterStyle); } if(o.afterCls){ this.addClass(o.afterCls); } if(o.remove === true){ this.remove(); } Ext.callback(o.callback, o.scope, [this]); if(!o.concurrent){ this.fxQueue.shift(); this.nextFx(); } }, getFxEl : function(){ return Ext.get(this.dom); }, fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){ animType = animType || 'run'; opt = opt || {}; var anim = Ext.lib.Anim[animType]( this.dom, args, (opt.duration || defaultDur) || .35, (opt.easing || defaultEase) || 'easeOut', function(){ Ext.callback(cb, this); }, this ); opt.anim = anim; return anim; } }; Ext.Fx.resize = Ext.Fx.scale; Ext.apply(Ext.Element.prototype, Ext.Fx); Ext.CompositeElement = function(els){ this.elements = []; this.addElements(els); }; Ext.CompositeElement.prototype = { isComposite: true, addElements : function(els){ if(!els) return this; if(typeof els == "string"){ els = Ext.Element.selectorFunction(els); } var yels = this.elements; var index = yels.length-1; for(var i = 0, len = els.length; i < len; i++) { yels[++index] = Ext.get(els[i]); } return this; }, fill : function(els){ this.elements = []; this.add(els); return this; }, filter : function(selector){ var els = []; this.each(function(el){ if(el.is(selector)){ els[els.length] = el.dom; } }); this.fill(els); return this; }, invoke : function(fn, args){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++) { Ext.Element.prototype[fn].apply(els[i], args); } return this; }, add : function(els){ if(typeof els == "string"){ this.addElements(Ext.Element.selectorFunction(els)); }else if(els.length !== undefined){ this.addElements(els); }else{ this.addElements([els]); } return this; }, each : function(fn, scope){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++){ if(fn.call(scope || els[i], els[i], this, i) === false) { break; } } return this; }, item : function(index){ return this.elements[index] || null; }, first : function(){ return this.item(0); }, last : function(){ return this.item(this.elements.length-1); }, getCount : function(){ return this.elements.length; }, contains : function(el){ return this.indexOf(el) !== -1; }, indexOf : function(el){ return this.elements.indexOf(Ext.get(el)); }, removeElement : function(el, removeDom){ if(Ext.isArray(el)){ for(var i = 0, len = el.length; i < len; i++){ this.removeElement(el[i]); } return this; } var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1 && this.elements[index]){ if(removeDom){ var d = this.elements[index]; if(d.dom){ d.remove(); }else{ Ext.removeNode(d); } } this.elements.splice(index, 1); } return this; }, replaceElement : function(el, replacement, domReplace){ var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1){ if(domReplace){ this.elements[index].replaceWith(replacement); }else{ this.elements.splice(index, 1, Ext.get(replacement)) } } return this; }, clear : function(){ this.elements = []; } }; (function(){ Ext.CompositeElement.createCall = function(proto, fnName){ if(!proto[fnName]){ proto[fnName] = function(){ return this.invoke(fnName, arguments); }; } }; for(var fnName in Ext.Element.prototype){ if(typeof Ext.Element.prototype[fnName] == "function"){ Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName); } }; })(); Ext.CompositeElementLite = function(els){ Ext.CompositeElementLite.superclass.constructor.call(this, els); this.el = new Ext.Element.Flyweight(); }; Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, { addElements : function(els){ if(els){ if(Ext.isArray(els)){ this.elements = this.elements.concat(els); }else{ var yels = this.elements; var index = yels.length-1; for(var i = 0, len = els.length; i < len; i++) { yels[++index] = els[i]; } } } return this; }, invoke : function(fn, args){ var els = this.elements; var el = this.el; for(var i = 0, len = els.length; i < len; i++) { el.dom = els[i]; Ext.Element.prototype[fn].apply(el, args); } return this; }, item : function(index){ if(!this.elements[index]){ return null; } this.el.dom = this.elements[index]; return this.el; }, addListener : function(eventName, handler, scope, opt){ var els = this.elements; for(var i = 0, len = els.length; i < len; i++) { Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt); } return this; }, each : function(fn, scope){ var els = this.elements; var el = this.el; for(var i = 0, len = els.length; i < len; i++){ el.dom = els[i]; if(fn.call(scope || el, el, this, i) === false){ break; } } return this; }, indexOf : function(el){ return this.elements.indexOf(Ext.getDom(el)); }, replaceElement : function(el, replacement, domReplace){ var index = typeof el == 'number' ? el : this.indexOf(el); if(index !== -1){ replacement = Ext.getDom(replacement); if(domReplace){ var d = this.elements[index]; d.parentNode.insertBefore(replacement, d); Ext.removeNode(d); } this.elements.splice(index, 1, replacement); } return this; } }); Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener; if(Ext.DomQuery){ Ext.Element.selectorFunction = Ext.DomQuery.select; } Ext.Element.select = function(selector, unique, root){ var els; if(typeof selector == "string"){ els = Ext.Element.selectorFunction(selector, root); }else if(selector.length !== undefined){ els = selector; }else{ throw "Invalid selector"; } if(unique === true){ return new Ext.CompositeElement(els); }else{ return new Ext.CompositeElementLite(els); } }; Ext.select = Ext.Element.select; Ext.data.Connection = function(config){ Ext.apply(this, config); this.addEvents( "beforerequest", "requestcomplete", "requestexception" ); Ext.data.Connection.superclass.constructor.call(this); }; Ext.extend(Ext.data.Connection, Ext.util.Observable, { timeout : 30000, autoAbort:false, disableCaching: true, request : function(o){ if(this.fireEvent("beforerequest", this, o) !== false){ var p = o.params; if(typeof p == "function"){ p = p.call(o.scope||window, o); } if(typeof p == "object"){ p = Ext.urlEncode(p); } if(this.extraParams){ var extras = Ext.urlEncode(this.extraParams); p = p ? (p + '&' + extras) : extras; } var url = o.url || this.url; if(typeof url == 'function'){ url = url.call(o.scope||window, o); } if(o.form){ var form = Ext.getDom(o.form); url = url || form.action; var enctype = form.getAttribute("enctype"); if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){ return this.doFormUpload(o, p, url); } var f = Ext.lib.Ajax.serializeForm(form); p = p ? (p + '&' + f) : f; } var hs = o.headers; if(this.defaultHeaders){ hs = Ext.apply(hs || {}, this.defaultHeaders); if(!o.headers){ o.headers = hs; } } var cb = { success: this.handleResponse, failure: this.handleFailure, scope: this, argument: {options: o}, timeout : o.timeout || this.timeout }; var method = o.method||this.method||(p ? "POST" : "GET"); if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){ url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime()); } if(typeof o.autoAbort == 'boolean'){ if(o.autoAbort){ this.abort(); } }else if(this.autoAbort !== false){ this.abort(); } if((method == 'GET' && p) || o.xmlData || o.jsonData){ url += (url.indexOf('?') != -1 ? '&' : '?') + p; p = ''; } this.transId = Ext.lib.Ajax.request(method, url, cb, p, o); return this.transId; }else{ Ext.callback(o.callback, o.scope, [o, null, null]); return null; } }, isLoading : function(transId){ if(transId){ return Ext.lib.Ajax.isCallInProgress(transId); }else{ return this.transId ? true : false; } }, abort : function(transId){ if(transId || this.isLoading()){ Ext.lib.Ajax.abort(transId || this.transId); } }, handleResponse : function(response){ this.transId = false; var options = response.argument.options; response.argument = options ? options.argument : null; this.fireEvent("requestcomplete", this, response, options); Ext.callback(options.success, options.scope, [response, options]); Ext.callback(options.callback, options.scope, [options, true, response]); }, handleFailure : function(response, e){ this.transId = false; var options = response.argument.options; response.argument = options ? options.argument : null; this.fireEvent("requestexception", this, response, options, e); Ext.callback(options.failure, options.scope, [response, options]); Ext.callback(options.callback, options.scope, [options, false, response]); }, doFormUpload : function(o, ps, url){ var id = Ext.id(); var frame = document.createElement('iframe'); frame.id = id; frame.name = id; frame.className = 'x-hidden'; if(Ext.isIE){ frame.src = Ext.SSL_SECURE_URL; } document.body.appendChild(frame); if(Ext.isIE){ document.frames[id].name = id; } var form = Ext.getDom(o.form); form.target = id; form.method = 'POST'; form.enctype = form.encoding = 'multipart/form-data'; if(url){ form.action = url; } var hiddens, hd; if(ps){ hiddens = []; ps = Ext.urlDecode(ps, false); for(var k in ps){ if(ps.hasOwnProperty(k)){ hd = document.createElement('input'); hd.type = 'hidden'; hd.name = k; hd.value = ps[k]; form.appendChild(hd); hiddens.push(hd); } } } function cb(){ var r = { responseText : '', responseXML : null }; r.argument = o ? o.argument : null; try { var doc; if(Ext.isIE){ doc = frame.contentWindow.document; }else { doc = (frame.contentDocument || window.frames[id].document); } if(doc && doc.body){ r.responseText = doc.body.innerHTML; } if(doc && doc.XMLDocument){ r.responseXML = doc.XMLDocument; }else { r.responseXML = doc; } } catch(e) { } Ext.EventManager.removeListener(frame, 'load', cb, this); this.fireEvent("requestcomplete", this, r, o); Ext.callback(o.success, o.scope, [r, o]); Ext.callback(o.callback, o.scope, [o, true, r]); setTimeout(function(){Ext.removeNode(frame);}, 100); } Ext.EventManager.on(frame, 'load', cb, this); form.submit(); if(hiddens){ for(var i = 0, len = hiddens.length; i < len; i++){ Ext.removeNode(hiddens[i]); } } } }); Ext.Ajax = new Ext.data.Connection({ autoAbort : false, serializeForm : function(form){ return Ext.lib.Ajax.serializeForm(form); } }); Ext.Updater = function(el, forceNew){ el = Ext.get(el); if(!forceNew && el.updateManager){ return el.updateManager; } this.el = el; this.defaultUrl = null; this.addEvents( "beforeupdate", "update", "failure" ); var d = Ext.Updater.defaults; this.sslBlankUrl = d.sslBlankUrl; this.disableCaching = d.disableCaching; this.indicatorText = d.indicatorText; this.showLoadIndicator = d.showLoadIndicator; this.timeout = d.timeout; this.loadScripts = d.loadScripts; this.transaction = null; this.autoRefreshProcId = null; this.refreshDelegate = this.refresh.createDelegate(this); this.updateDelegate = this.update.createDelegate(this); this.formUpdateDelegate = this.formUpdate.createDelegate(this); if(!this.renderer){ this.renderer = new Ext.Updater.BasicRenderer(); } Ext.Updater.superclass.constructor.call(this); }; Ext.extend(Ext.Updater, Ext.util.Observable, { getEl : function(){ return this.el; }, update : function(url, params, callback, discardUrl){ if(this.fireEvent("beforeupdate", this.el, url, params) !== false){ var method = this.method, cfg, callerScope; if(typeof url == "object"){ cfg = url; url = cfg.url; params = params || cfg.params; callback = callback || cfg.callback; discardUrl = discardUrl || cfg.discardUrl; callerScope = cfg.scope; if(typeof cfg.method != "undefined"){method = cfg.method;}; if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;}; if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";}; if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;}; if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;}; } this.showLoading(); if(!discardUrl){ this.defaultUrl = url; } if(typeof url == "function"){ url = url.call(this); } method = method || (params ? "POST" : "GET"); if(method == "GET"){ url = this.prepareUrl(url); } var o = Ext.apply(cfg ||{}, { url : url, params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params, success: this.processSuccess, failure: this.processFailure, scope: this, callback: undefined, timeout: (this.timeout*1000), argument: { "options": cfg, "url": url, "form": null, "callback": callback, "scope": callerScope || window, "params": params } }); this.transaction = Ext.Ajax.request(o); } }, formUpdate : function(form, url, reset, callback){ if(this.fireEvent("beforeupdate", this.el, form, url) !== false){ if(typeof url == "function"){ url = url.call(this); } form = Ext.getDom(form) this.transaction = Ext.Ajax.request({ form: form, url:url, success: this.processSuccess, failure: this.processFailure, scope: this, timeout: (this.timeout*1000), argument: { "url": url, "form": form, "callback": callback, "reset": reset } }); this.showLoading.defer(1, this); } }, refresh : function(callback){ if(this.defaultUrl == null){ return; } this.update(this.defaultUrl, null, callback, true); }, startAutoRefresh : function(interval, url, params, callback, refreshNow){ if(refreshNow){ this.update(url || this.defaultUrl, params, callback, true); } if(this.autoRefreshProcId){ clearInterval(this.autoRefreshProcId); } this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000); }, stopAutoRefresh : function(){ if(this.autoRefreshProcId){ clearInterval(this.autoRefreshProcId); delete this.autoRefreshProcId; } }, isAutoRefreshing : function(){ return this.autoRefreshProcId ? true : false; }, showLoading : function(){ if(this.showLoadIndicator){ this.el.update(this.indicatorText); } }, prepareUrl : function(url){ if(this.disableCaching){ var append = "_dc=" + (new Date().getTime()); if(url.indexOf("?") !== -1){ url += "&" + append; }else{ url += "?" + append; } } return url; }, processSuccess : function(response){ this.transaction = null; if(response.argument.form && response.argument.reset){ try{ response.argument.form.reset(); }catch(e){} } if(this.loadScripts){ this.renderer.render(this.el, response, this, this.updateComplete.createDelegate(this, [response])); }else{ this.renderer.render(this.el, response, this); this.updateComplete(response); } }, updateComplete : function(response){ this.fireEvent("update", this.el, response); if(typeof response.argument.callback == "function"){ response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options); } }, processFailure : function(response){ this.transaction = null; this.fireEvent("failure", this.el, response); if(typeof response.argument.callback == "function"){ response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options); } }, setRenderer : function(renderer){ this.renderer = renderer; }, getRenderer : function(){ return this.renderer; }, setDefaultUrl : function(defaultUrl){ this.defaultUrl = defaultUrl; }, abort : function(){ if(this.transaction){ Ext.Ajax.abort(this.transaction); } }, isUpdating : function(){ if(this.transaction){ return Ext.Ajax.isLoading(this.transaction); } return false; } }); Ext.Updater.defaults = { timeout : 30, loadScripts : false, sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"), disableCaching : false, showLoadIndicator : true, indicatorText : '<div class="loading-indicator">Loading...</div>' }; Ext.Updater.updateElement = function(el, url, params, options){ var um = Ext.get(el).getUpdater(); Ext.apply(um, options); um.update(url, params, options ? options.callback : null); }; Ext.Updater.update = Ext.Updater.updateElement; Ext.Updater.BasicRenderer = function(){}; Ext.Updater.BasicRenderer.prototype = { render : function(el, response, updateManager, callback){ el.update(response.responseText, updateManager.loadScripts, callback); } }; Ext.UpdateManager = Ext.Updater; Ext.util.DelayedTask = function(fn, scope, args){ var id = null, d, t; var call = function(){ var now = new Date().getTime(); if(now - t >= d){ clearInterval(id); id = null; fn.apply(scope, args || []); } }; this.delay = function(delay, newFn, newScope, newArgs){ if(id && delay != d){ this.cancel(); } d = delay; t = new Date().getTime(); fn = newFn || fn; scope = newScope || scope; args = newArgs || args; if(!id){ id = setInterval(call, d); } }; this.cancel = function(){ if(id){ clearInterval(id); id = null; } }; };
08to09-processwave
oryx/editor/lib/ext-2.0.2/ext-core-debug.js
JavaScript
mit
164,856
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>jQuery UI Example Page</title> <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.1.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script> <script type="text/javascript"> $(function(){ // Accordion $("#accordion").accordion({ header: "h3" }); // Tabs $('#tabs').tabs(); // Dialog $('#dialog').dialog({ autoOpen: false, width: 600, buttons: { "Ok": function() { $(this).dialog("close"); }, "Cancel": function() { $(this).dialog("close"); } } }); // Dialog Link $('#dialog_link').click(function(){ $('#dialog').dialog('open'); return false; }); // Datepicker $('#datepicker').datepicker({ inline: true }); // Slider $('#slider').slider({ range: true, values: [17, 67] }); // Progressbar $("#progressbar").progressbar({ value: 20 }); //hover states on the static widgets $('#dialog_link, ul#icons li').hover( function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); } ); }); </script> <style type="text/css"> /*demo page css*/ body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;} .demoHeaders { margin-top: 2em; } #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;} #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;} ul#icons {margin: 0; padding: 0;} ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;} ul#icons span.ui-icon {float: left; margin: 0 4px;} </style> </head> <body> <h1>Welcome to jQuery UI!</h1> <p style="font-size: 1.3em; line-height: 1.5; margin: 1em 0; width: 50%;">This page demonstrates the widgets you downloaded using the theme you selected in the download builder. We've included and linked to minified versions of <a href="js/jquery-1.4.2.min.js">jQuery</a>, your personalized copy of <a href="js/jquery-ui-1.8.1.custom.min.js">jQuery UI (js/jquery-ui-1.8.1.custom.min.js)</a>, and <a href="css/ui-lightness/jquery-ui-1.8.1.custom.css">css/ui-lightness/jquery-ui-1.8.1.custom.css</a> which imports the entire jQuery UI CSS Framework. You can choose to link a subset of the CSS Framework depending on your needs. </p> <p style="font-size: 1.2em; line-height: 1.5; margin: 1em 0; width: 50%;">You've downloaded components and a theme that are compatible with jQuery 1.3+. Please make sure you are using jQuery 1.3+ in your production environment.</p> <p style="font-weight: bold; margin: 2em 0 1em; font-size: 1.3em;">YOUR COMPONENTS:</p> <!-- Accordion --> <h2 class="demoHeaders">Accordion</h2> <div id="accordion"> <div> <h3><a href="#">First</a></h3> <div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div> </div> <div> <h3><a href="#">Second</a></h3> <div>Phasellus mattis tincidunt nibh.</div> </div> <div> <h3><a href="#">Third</a></h3> <div>Nam dui erat, auctor a, dignissim quis.</div> </div> </div> <!-- Tabs --> <h2 class="demoHeaders">Tabs</h2> <div id="tabs"> <ul> <li><a href="#tabs-1">First</a></li> <li><a href="#tabs-2">Second</a></li> <li><a href="#tabs-3">Third</a></li> </ul> <div id="tabs-1">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div> <div id="tabs-2">Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.</div> <div id="tabs-3">Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.</div> </div> <!-- Dialog NOTE: Dialog is not generated by UI in this demo so it can be visually styled in themeroller--> <h2 class="demoHeaders">Dialog</h2> <p><a href="#" id="dialog_link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Open Dialog</a></p> <h2 class="demoHeaders">Overlay and Shadow Classes <em>(not currently used in UI widgets)</em></h2> <div style="position: relative; width: 96%; height: 200px; padding:1% 4%; overflow:hidden;" class="fakewindowcontain"> <p>Lorem ipsum dolor sit amet, Nulla nec tortor. Donec id elit quis purus consectetur consequat. </p><p>Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. </p><p>Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. </p><p>Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. </p><p>Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. Aliquam ante. </p><p>Suspendisse scelerisque dui nec velit. Duis augue augue, gravida euismod, vulputate ac, facilisis id, sem. Morbi in orci. Nulla purus lacus, pulvinar vel, malesuada ac, mattis nec, quam. Nam molestie scelerisque quam. Nullam feugiat cursus lacus.orem ipsum dolor sit amet, consectetur adipiscing elit. Donec libero risus, commodo vitae, pharetra mollis, posuere eu, pede. Nulla nec tortor. Donec id elit quis purus consectetur consequat. Nam congue semper tellus. Sed erat dolor, dapibus sit amet, venenatis ornare, ultrices ut, nisi. </p> <!-- ui-dialog --> <div class="ui-overlay"><div class="ui-widget-overlay"></div><div class="ui-widget-shadow ui-corner-all" style="width: 302px; height: 152px; position: absolute; left: 50px; top: 30px;"></div></div> <div style="position: absolute; width: 280px; height: 130px;left: 50px; top: 30px; padding: 10px;" class="ui-widget ui-widget-content ui-corner-all"> <div class="ui-dialog-content ui-widget-content" style="background: none; border: 0;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> </div> </div> <!-- ui-dialog --> <div id="dialog" title="Dialog Title"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> <h2 class="demoHeaders">Framework Icons (content color preview)</h2> <ul id="icons" class="ui-widget ui-helper-clearfix"> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-n"><span class="ui-icon ui-icon-carat-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-ne"><span class="ui-icon ui-icon-carat-1-ne"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-e"><span class="ui-icon ui-icon-carat-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-se"><span class="ui-icon ui-icon-carat-1-se"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-s"><span class="ui-icon ui-icon-carat-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-sw"><span class="ui-icon ui-icon-carat-1-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-w"><span class="ui-icon ui-icon-carat-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-1-nw"><span class="ui-icon ui-icon-carat-1-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-2-n-s"><span class="ui-icon ui-icon-carat-2-n-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-carat-2-e-w"><span class="ui-icon ui-icon-carat-2-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-n"><span class="ui-icon ui-icon-triangle-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-ne"><span class="ui-icon ui-icon-triangle-1-ne"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-e"><span class="ui-icon ui-icon-triangle-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-se"><span class="ui-icon ui-icon-triangle-1-se"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-s"><span class="ui-icon ui-icon-triangle-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-sw"><span class="ui-icon ui-icon-triangle-1-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-w"><span class="ui-icon ui-icon-triangle-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-1-nw"><span class="ui-icon ui-icon-triangle-1-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-2-n-s"><span class="ui-icon ui-icon-triangle-2-n-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-triangle-2-e-w"><span class="ui-icon ui-icon-triangle-2-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-n"><span class="ui-icon ui-icon-arrow-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-ne"><span class="ui-icon ui-icon-arrow-1-ne"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-e"><span class="ui-icon ui-icon-arrow-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-se"><span class="ui-icon ui-icon-arrow-1-se"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-s"><span class="ui-icon ui-icon-arrow-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-sw"><span class="ui-icon ui-icon-arrow-1-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-w"><span class="ui-icon ui-icon-arrow-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-1-nw"><span class="ui-icon ui-icon-arrow-1-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-n-s"><span class="ui-icon ui-icon-arrow-2-n-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-ne-sw"><span class="ui-icon ui-icon-arrow-2-ne-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-e-w"><span class="ui-icon ui-icon-arrow-2-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-2-se-nw"><span class="ui-icon ui-icon-arrow-2-se-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-n"><span class="ui-icon ui-icon-arrowstop-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-e"><span class="ui-icon ui-icon-arrowstop-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-s"><span class="ui-icon ui-icon-arrowstop-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowstop-1-w"><span class="ui-icon ui-icon-arrowstop-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-n"><span class="ui-icon ui-icon-arrowthick-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-ne"><span class="ui-icon ui-icon-arrowthick-1-ne"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-e"><span class="ui-icon ui-icon-arrowthick-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-se"><span class="ui-icon ui-icon-arrowthick-1-se"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-s"><span class="ui-icon ui-icon-arrowthick-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-sw"><span class="ui-icon ui-icon-arrowthick-1-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-w"><span class="ui-icon ui-icon-arrowthick-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-1-nw"><span class="ui-icon ui-icon-arrowthick-1-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-n-s"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-ne-sw"><span class="ui-icon ui-icon-arrowthick-2-ne-sw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-e-w"><span class="ui-icon ui-icon-arrowthick-2-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthick-2-se-nw"><span class="ui-icon ui-icon-arrowthick-2-se-nw"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-n"><span class="ui-icon ui-icon-arrowthickstop-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-e"><span class="ui-icon ui-icon-arrowthickstop-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-s"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowthickstop-1-w"><span class="ui-icon ui-icon-arrowthickstop-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-w"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-n"><span class="ui-icon ui-icon-arrowreturnthick-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-e"><span class="ui-icon ui-icon-arrowreturnthick-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturnthick-1-s"><span class="ui-icon ui-icon-arrowreturnthick-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-w"><span class="ui-icon ui-icon-arrowreturn-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-n"><span class="ui-icon ui-icon-arrowreturn-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-e"><span class="ui-icon ui-icon-arrowreturn-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowreturn-1-s"><span class="ui-icon ui-icon-arrowreturn-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-w"><span class="ui-icon ui-icon-arrowrefresh-1-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-n"><span class="ui-icon ui-icon-arrowrefresh-1-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-e"><span class="ui-icon ui-icon-arrowrefresh-1-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrowrefresh-1-s"><span class="ui-icon ui-icon-arrowrefresh-1-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-4"><span class="ui-icon ui-icon-arrow-4"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-arrow-4-diag"><span class="ui-icon ui-icon-arrow-4-diag"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-extlink"><span class="ui-icon ui-icon-extlink"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-newwin"><span class="ui-icon ui-icon-newwin"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-refresh"><span class="ui-icon ui-icon-refresh"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-shuffle"><span class="ui-icon ui-icon-shuffle"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-transfer-e-w"><span class="ui-icon ui-icon-transfer-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-transferthick-e-w"><span class="ui-icon ui-icon-transferthick-e-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-folder-collapsed"><span class="ui-icon ui-icon-folder-collapsed"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-folder-open"><span class="ui-icon ui-icon-folder-open"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-document"><span class="ui-icon ui-icon-document"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-document-b"><span class="ui-icon ui-icon-document-b"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-note"><span class="ui-icon ui-icon-note"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-mail-closed"><span class="ui-icon ui-icon-mail-closed"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-mail-open"><span class="ui-icon ui-icon-mail-open"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-suitcase"><span class="ui-icon ui-icon-suitcase"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-comment"><span class="ui-icon ui-icon-comment"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-person"><span class="ui-icon ui-icon-person"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-print"><span class="ui-icon ui-icon-print"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-trash"><span class="ui-icon ui-icon-trash"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-locked"><span class="ui-icon ui-icon-locked"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-unlocked"><span class="ui-icon ui-icon-unlocked"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-bookmark"><span class="ui-icon ui-icon-bookmark"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-tag"><span class="ui-icon ui-icon-tag"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-home"><span class="ui-icon ui-icon-home"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-flag"><span class="ui-icon ui-icon-flag"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-calculator"><span class="ui-icon ui-icon-calculator"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-cart"><span class="ui-icon ui-icon-cart"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-pencil"><span class="ui-icon ui-icon-pencil"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-clock"><span class="ui-icon ui-icon-clock"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-disk"><span class="ui-icon ui-icon-disk"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-calendar"><span class="ui-icon ui-icon-calendar"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-zoomin"><span class="ui-icon ui-icon-zoomin"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-zoomout"><span class="ui-icon ui-icon-zoomout"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-search"><span class="ui-icon ui-icon-search"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-wrench"><span class="ui-icon ui-icon-wrench"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-gear"><span class="ui-icon ui-icon-gear"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-heart"><span class="ui-icon ui-icon-heart"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-star"><span class="ui-icon ui-icon-star"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-link"><span class="ui-icon ui-icon-link"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-cancel"><span class="ui-icon ui-icon-cancel"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-plus"><span class="ui-icon ui-icon-plus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-plusthick"><span class="ui-icon ui-icon-plusthick"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-minus"><span class="ui-icon ui-icon-minus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-minusthick"><span class="ui-icon ui-icon-minusthick"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-close"><span class="ui-icon ui-icon-close"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-closethick"><span class="ui-icon ui-icon-closethick"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-key"><span class="ui-icon ui-icon-key"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-lightbulb"><span class="ui-icon ui-icon-lightbulb"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-scissors"><span class="ui-icon ui-icon-scissors"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-clipboard"><span class="ui-icon ui-icon-clipboard"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-copy"><span class="ui-icon ui-icon-copy"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-contact"><span class="ui-icon ui-icon-contact"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-image"><span class="ui-icon ui-icon-image"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-video"><span class="ui-icon ui-icon-video"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-script"><span class="ui-icon ui-icon-script"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-alert"><span class="ui-icon ui-icon-alert"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-info"><span class="ui-icon ui-icon-info"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-notice"><span class="ui-icon ui-icon-notice"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-help"><span class="ui-icon ui-icon-help"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-check"><span class="ui-icon ui-icon-check"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-bullet"><span class="ui-icon ui-icon-bullet"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-radio-off"><span class="ui-icon ui-icon-radio-off"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-radio-on"><span class="ui-icon ui-icon-radio-on"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-pin-w"><span class="ui-icon ui-icon-pin-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-pin-s"><span class="ui-icon ui-icon-pin-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-play"><span class="ui-icon ui-icon-play"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-pause"><span class="ui-icon ui-icon-pause"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-seek-next"><span class="ui-icon ui-icon-seek-next"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-seek-prev"><span class="ui-icon ui-icon-seek-prev"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-seek-end"><span class="ui-icon ui-icon-seek-end"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-seek-first"><span class="ui-icon ui-icon-seek-first"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-stop"><span class="ui-icon ui-icon-stop"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-eject"><span class="ui-icon ui-icon-eject"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-volume-off"><span class="ui-icon ui-icon-volume-off"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-volume-on"><span class="ui-icon ui-icon-volume-on"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-power"><span class="ui-icon ui-icon-power"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-signal-diag"><span class="ui-icon ui-icon-signal-diag"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-signal"><span class="ui-icon ui-icon-signal"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-battery-0"><span class="ui-icon ui-icon-battery-0"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-battery-1"><span class="ui-icon ui-icon-battery-1"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-battery-2"><span class="ui-icon ui-icon-battery-2"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-battery-3"><span class="ui-icon ui-icon-battery-3"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-plus"><span class="ui-icon ui-icon-circle-plus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-minus"><span class="ui-icon ui-icon-circle-minus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-close"><span class="ui-icon ui-icon-circle-close"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-e"><span class="ui-icon ui-icon-circle-triangle-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-s"><span class="ui-icon ui-icon-circle-triangle-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-w"><span class="ui-icon ui-icon-circle-triangle-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-triangle-n"><span class="ui-icon ui-icon-circle-triangle-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-e"><span class="ui-icon ui-icon-circle-arrow-e"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-s"><span class="ui-icon ui-icon-circle-arrow-s"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-w"><span class="ui-icon ui-icon-circle-arrow-w"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-arrow-n"><span class="ui-icon ui-icon-circle-arrow-n"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-zoomin"><span class="ui-icon ui-icon-circle-zoomin"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-zoomout"><span class="ui-icon ui-icon-circle-zoomout"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circle-check"><span class="ui-icon ui-icon-circle-check"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-plus"><span class="ui-icon ui-icon-circlesmall-plus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-minus"><span class="ui-icon ui-icon-circlesmall-minus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-circlesmall-close"><span class="ui-icon ui-icon-circlesmall-close"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-plus"><span class="ui-icon ui-icon-squaresmall-plus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-minus"><span class="ui-icon ui-icon-squaresmall-minus"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-squaresmall-close"><span class="ui-icon ui-icon-squaresmall-close"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-grip-dotted-vertical"><span class="ui-icon ui-icon-grip-dotted-vertical"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-grip-dotted-horizontal"><span class="ui-icon ui-icon-grip-dotted-horizontal"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-grip-solid-vertical"><span class="ui-icon ui-icon-grip-solid-vertical"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-grip-solid-horizontal"><span class="ui-icon ui-icon-grip-solid-horizontal"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-gripsmall-diagonal-se"><span class="ui-icon ui-icon-gripsmall-diagonal-se"></span></li> <li class="ui-state-default ui-corner-all" title=".ui-icon-grip-diagonal-se"><span class="ui-icon ui-icon-grip-diagonal-se"></span></li> </ul> <!-- Slider --> <h2 class="demoHeaders">Slider</h2> <div id="slider"></div> <!-- Datepicker --> <h2 class="demoHeaders">Datepicker</h2> <div id="datepicker"></div> <!-- Progressbar --> <h2 class="demoHeaders">Progressbar</h2> <div id="progressbar"></div> <!-- Highlight / Error --> <h2 class="demoHeaders">Highlight / Error</h2> <div class="ui-widget"> <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> <strong>Hey!</strong> Sample ui-state-highlight style.</p> </div> </div> <br/> <div class="ui-widget"> <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong>Alert:</strong> Sample ui-state-error style.</p> </div> </div> </body> </html>
08to09-processwave
oryx/editor/lib/jquery-ui-1.8.1.custom/index.html
HTML
mit
31,569
package com.example.Sorteando; import java.util.Collections; import java.util.List; public class Embaralhar { public List <String> embra(List<String> lists){ Collections.shuffle(lists); return lists; } }
01010001010luck0010
Sorteando/src/com/example/Sorteando/Embaralhar.java
Java
asf20
234
package com.example.Sorteando; import android.os.AsyncTask; import android.util.Log; import android.widget.ProgressBar; public class LoadingTask extends AsyncTask<String, Integer, Integer> { public interface LoadingTaskFinishedListener { void onTaskFinished(); // If you want to pass something back to the listener add a param to this method } // This is the progress bar you want to update while the task is in progress private final ProgressBar progressBar; // This is the listener that will be told when this task is finished private final LoadingTaskFinishedListener finishedListener; /** * A Loading task that will load some resources that are necessary for the app to start * @param progressBar - the progress bar you want to update while the task is in progress * @param finishedListener - the listener that will be told when this task is finished */ public LoadingTask(ProgressBar progressBar, LoadingTaskFinishedListener finishedListener) { this.progressBar = progressBar; this.finishedListener = finishedListener; } protected Integer doInBackground(String... params) { Log.i("Tutorial", "Starting task with url: "+params[0]); if(resourcesDontAlreadyExist()){ downloadResources(); } // Perhaps you want to return something to your post execute return 1234; } private boolean resourcesDontAlreadyExist() { // Here you would query your app's internal state to see if this download had been performed before // Perhaps once checked save this in a shared preference for speed of access next time return true; // returning true so we show the splash every time } private void downloadResources() { // We are just imitating some process thats takes a bit of time (loading of resources / downloading) int count = 10; for (int i = 0; i < count; i++) { // Update the progress bar after every step int progress = (int) ((i / (float) count) * 100); publishProgress(progress); // Do some long loading things try { Thread.sleep(1000); } catch (InterruptedException ignore) {} } } protected void onProgressUpdate(Integer... values) { super.onProgressUpdate(values); progressBar.setProgress(values[0]); // This is ran on the UI thread so it is ok to update our progress bar ( a UI view ) here } protected void onPostExecute(Integer result) { super.onPostExecute(result); finishedListener.onTaskFinished(); // Tell whoever was listening we have finished } }
01010001010luck0010
Sorteando/src/com/example/Sorteando/LoadingTask.java
Java
asf20
2,763
package com.example.Sorteando; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Window; import android.widget.ProgressBar; import com.example.Sorteando.LoadingTask.LoadingTaskFinishedListener; public class inicoactivity extends Activity implements LoadingTaskFinishedListener{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); // Show the splash screen setContentView(R.layout.inicioactivity); // Find the progress bar ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar1); // Start your loading new LoadingTask(progressBar, this).execute("http://tecksoft.com.br/"); // Pass in whatever you need a url is just an example we don't use it in this tutorial } // This is the callback for when your async task has finished @Override public void onTaskFinished() { completeSplash(); } private void completeSplash(){ startApp(); finish(); // Don't forget to finish this Splash Activity so the user can't return to it! } private void startApp() { Intent intent = new Intent(inicoactivity.this, add_activity.class); startActivity(intent); } }
01010001010luck0010
Sorteando/src/com/example/Sorteando/inicoactivity.java
Java
asf20
1,398
from composite import CompositeGoal from onek_onek import OneKingAttackOneKingEvaluator, OneKingFleeOneKingEvaluator class Goal_Think(CompositeGoal): def __init__(self, owner): CompositeGoal.__init__(self, owner) self.evaluators = [OneKingAttackOneKingEvaluator(1.0), OneKingFleeOneKingEvaluator(1.0)] def activate(self): self.arbitrate() self.status = self.ACTIVE def process(self): self.activateIfInactive() status = self.processSubgoals() if status == self.COMPLETED or status == self.FAILED: self.status = self.INACTIVE return status def terminate(self): pass def arbitrate(self): most_desirable = None best_score = 0 for e in self.evaluators: d = e.calculateDesirability() if d > best_score: most_desirable = e best_score = d if most_desirable: most_desirable.setGoal(self.owner) return best_score
00eadeyemi-clone
think.py
Python
mit
1,103
from goal import Goal class CompositeGoal(Goal): def __init__(self, owner): Goal.__init__(self, owner) self.subgoals = [] def removeAllSubgoals(self): for s in self.subgoals: s.terminate() self.subgoals = [] def processSubgoals(self): # remove all completed and failed goals from the front of the # subgoal list while (self.subgoals and (self.subgoals[0].isComplete or self.subgoals[0].hasFailed)): subgoal = self.subgoals.pop() subgoal.terminate() if (self.subgoals): subgoal = self.subgoals.pop() status = subgoal.process() if status == COMPLETED and len(self.subgoals) > 1: return ACTIVE return status else: return COMPLETED def addSubgoal(self, goal): self.subgoals.append(goal)
00eadeyemi-clone
composite.py
Python
mit
963
import unittest import checkers import games from globalconst import * # (white) # 45 46 47 48 # 39 40 41 42 # 34 35 36 37 # 28 29 30 31 # 23 24 25 26 # 17 18 19 20 # 12 13 14 15 # 6 7 8 9 # (black) class TestBlackManSingleJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state squares = self.board.squares self.board.clear() squares[6] = BLACK | MAN squares[12] = WHITE | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[6, BLACK | MAN, FREE], [12, WHITE | MAN, FREE], [18, FREE, BLACK | MAN]]) class TestBlackManDoubleJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state squares = self.board.squares self.board.clear() squares[6] = BLACK | MAN squares[12] = WHITE | MAN squares[23] = WHITE | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[6, BLACK | MAN, FREE], [12, WHITE | MAN, FREE], [18, FREE, FREE], [23, WHITE | MAN, FREE], [28, FREE, BLACK | MAN]]) class TestBlackManCrownKingOnJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state squares = self.board.squares self.board.clear() # (white) # 45 46 47 48 # 39 40 41 42 # 34 35 36 37 # 28 29 30 31 # 23 24 25 26 # 17 18 19 20 # 12 13 14 15 # 6 7 8 9 # (black) squares[12] = BLACK | MAN squares[18] = WHITE | MAN squares[30] = WHITE | MAN squares[41] = WHITE | MAN # set another man on 40 to test that crowning # move ends the turn squares[40] = WHITE | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[12, BLACK | MAN, FREE], [18, WHITE | MAN, FREE], [24, FREE, FREE], [30, WHITE | MAN, FREE], [36, FREE, FREE], [41, WHITE | MAN, FREE], [46, FREE, BLACK | KING]]) class TestBlackManCrownKingOnMove(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state squares = self.board.squares self.board.clear() squares[39] = BLACK | MAN squares[18] = WHITE | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[39, BLACK | MAN, FREE], [45, FREE, BLACK | KING]]) class TestBlackKingOptionalJumpDiamond(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state squares = self.board.squares self.board.clear() squares[13] = BLACK | KING squares[19] = WHITE | MAN squares[30] = WHITE | MAN squares[29] = WHITE | MAN squares[18] = WHITE | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[13, BLACK | KING, FREE], [18, WHITE | MAN, FREE], [23, FREE, FREE], [29, WHITE | MAN, FREE], [35, FREE, FREE], [30, WHITE | MAN, FREE], [25, FREE, FREE], [19, WHITE | MAN, FREE], [13, FREE, BLACK | KING]]) self.assertEqual(moves[1].affected_squares, [[13, BLACK | KING, FREE], [19, WHITE | MAN, FREE], [25, FREE, FREE], [30, WHITE | MAN, FREE], [35, FREE, FREE], [29, WHITE | MAN, FREE], [23, FREE, FREE], [18, WHITE | MAN, FREE], [13, FREE, BLACK | KING]]) class TestWhiteManSingleJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE squares = self.board.squares self.board.clear() squares[41] = WHITE | MAN squares[36] = BLACK | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[41, WHITE | MAN, FREE], [36, BLACK | MAN, FREE], [31, FREE, WHITE | MAN]]) class TestWhiteManDoubleJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE squares = self.board.squares self.board.clear() squares[41] = WHITE | MAN squares[36] = BLACK | MAN squares[25] = BLACK | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[41, WHITE | MAN, FREE], [36, BLACK | MAN, FREE], [31, FREE, FREE], [25, BLACK | MAN, FREE], [19, FREE, WHITE | MAN]]) class TestWhiteManCrownKingOnMove(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE squares = self.board.squares self.board.clear() squares[15] = WHITE | MAN squares[36] = BLACK | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[15, WHITE | MAN, FREE], [9, FREE, WHITE | KING]]) class TestWhiteManCrownKingOnJump(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE squares = self.board.squares self.board.clear() squares[41] = WHITE | MAN squares[36] = BLACK | MAN squares[25] = BLACK | MAN squares[13] = BLACK | KING # set another man on 10 to test that crowning # move ends the turn squares[12] = BLACK | KING def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[41, WHITE | MAN, FREE], [36, BLACK | MAN, FREE], [31, FREE, FREE], [25, BLACK | MAN, FREE], [19, FREE, FREE], [13, BLACK | KING, FREE], [7, FREE, WHITE | KING]]) class TestWhiteKingOptionalJumpDiamond(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE squares = self.board.squares self.board.clear() squares[13] = WHITE | KING squares[19] = BLACK | MAN squares[30] = BLACK | MAN squares[29] = BLACK | MAN squares[18] = BLACK | MAN def testJump(self): moves = self.game.legal_moves(self.board) self.assertEqual(moves[0].affected_squares, [[13, WHITE | KING, FREE], [18, BLACK | MAN, FREE], [23, FREE, FREE], [29, BLACK | MAN, FREE], [35, FREE, FREE], [30, BLACK | MAN, FREE], [25, FREE, FREE], [19, BLACK | MAN, FREE], [13, FREE, WHITE | KING]]) self.assertEqual(moves[1].affected_squares, [[13, WHITE | KING, FREE], [19, BLACK | MAN, FREE], [25, FREE, FREE], [30, BLACK | MAN, FREE], [35, FREE, FREE], [29, BLACK | MAN, FREE], [23, FREE, FREE], [18, BLACK | MAN, FREE], [13, FREE, WHITE | KING]]) class TestUtilityFunc(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state self.board.to_move = WHITE self.squares = self.board.squares def testInitialUtility(self): code = sum(self.board.value[s] for s in self.squares) nwm = code % 16 nwk = (code >> 4) % 16 nbm = (code >> 8) % 16 nbk = (code >> 12) % 16 nm = nbm + nwm nk = nbk + nwk self.assertEqual(self.board._eval_cramp(self.squares), 0) self.assertEqual(self.board._eval_backrankguard(self.squares), 0) self.assertEqual(self.board._eval_doublecorner(self.squares), 0) self.assertEqual(self.board._eval_center(self.squares), 0) self.assertEqual(self.board._eval_edge(self.squares), 0) self.assertEqual(self.board._eval_tempo(self.squares, nm, nbk, nbm, nwk, nwm), 0) self.assertEqual(self.board._eval_playeropposition(self.squares, nwm, nwk, nbk, nbm, nm, nk), 0) self.assertEqual(self.board.utility(WHITE), -2) class TestSuccessorFuncForBlack(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state def testInitialBlackMoves(self): # Tests whether initial game moves are correct from # Black's perspective moves = [m for m, _ in self.game.successors(self.board)] self.assertEqual(moves[0].affected_squares, [[17, BLACK | MAN, FREE], [23, FREE, BLACK | MAN]]) self.assertEqual(moves[1].affected_squares, [[18, BLACK | MAN, FREE], [23, FREE, BLACK | MAN]]) self.assertEqual(moves[2].affected_squares, [[18, BLACK | MAN, FREE], [24, FREE, BLACK | MAN]]) self.assertEqual(moves[3].affected_squares, [[19, BLACK | MAN, FREE], [24, FREE, BLACK | MAN]]) self.assertEqual(moves[4].affected_squares, [[19, BLACK | MAN, FREE], [25, FREE, BLACK | MAN]]) self.assertEqual(moves[5].affected_squares, [[20, BLACK | MAN, FREE], [25, FREE, BLACK | MAN]]) self.assertEqual(moves[6].affected_squares, [[20, BLACK | MAN, FREE], [26, FREE, BLACK | MAN]]) class TestSuccessorFuncForWhite(unittest.TestCase): def setUp(self): self.game = checkers.Checkers() self.board = self.game.curr_state # I'm cheating here ... white never moves first in # a real game, but I want to see that the moves # would work anyway. self.board.to_move = WHITE def testInitialWhiteMoves(self): # Tests whether initial game moves are correct from # White's perspective moves = [m for m, _ in self.game.successors(self.board)] self.assertEqual(moves[0].affected_squares, [[34, WHITE | MAN, FREE], [29, FREE, WHITE | MAN]]) self.assertEqual(moves[1].affected_squares, [[34, WHITE | MAN, FREE], [28, FREE, WHITE | MAN]]) self.assertEqual(moves[2].affected_squares, [[35, WHITE | MAN, FREE], [30, FREE, WHITE | MAN]]) self.assertEqual(moves[3].affected_squares, [[35, WHITE | MAN, FREE], [29, FREE, WHITE | MAN]]) self.assertEqual(moves[4].affected_squares, [[36, WHITE | MAN, FREE], [31, FREE, WHITE | MAN]]) self.assertEqual(moves[5].affected_squares, [[36, WHITE | MAN, FREE], [30, FREE, WHITE | MAN]]) self.assertEqual(moves[6].affected_squares, [[37, WHITE | MAN, FREE], [31, FREE, WHITE | MAN]]) if __name__ == '__main__': unittest.main()
00eadeyemi-clone
testcb.py
Python
mit
13,434
import utils class Observer(object): def update(self, change): utils.abstract()
00eadeyemi-clone
observer.py
Python
mit
100
import re import sys class LinkRules(object): """Rules for recognizing external links.""" # For the link targets: proto = r'http|https|ftp|nntp|news|mailto|telnet|file|irc' extern = r'(?P<extern_addr>(?P<extern_proto>%s):.*)' % proto interwiki = r''' (?P<inter_wiki> [A-Z][a-zA-Z]+ ) : (?P<inter_page> .* ) ''' def __init__(self): self.addr_re = re.compile('|'.join([ self.extern, self.interwiki, ]), re.X | re.U) # for addresses class Rules(object): """Hold all the rules for generating regular expressions.""" # For the inline elements: proto = r'http|https|ftp|nntp|news|mailto|telnet|file|irc' link = r'''(?P<link> \[\[ (?P<link_target>.+?) \s* ([|] \s* (?P<link_text>.+?) \s*)? ]] )''' image = r'''(?P<image> {{ (?P<image_target>.+?) \s* ([|] \s* (?P<image_text>.+?) \s*)? }} )''' macro = r'''(?P<macro> << (?P<macro_name> \w+) (\( (?P<macro_args> .*?) \))? \s* ([|] \s* (?P<macro_text> .+?) \s* )? >> )''' code = r'(?P<code> {{{ (?P<code_text>.*?) }}} )' emph = r'(?P<emph> (?<!:)// )' # there must be no : in front of the // # avoids italic rendering in urls with # unknown protocols strong = r'(?P<strong> \*\* )' linebreak = r'(?P<break> \\\\ )' escape = r'(?P<escape> ~ (?P<escaped_char>\S) )' char = r'(?P<char> . )' # For the block elements: separator = r'(?P<separator> ^ \s* ---- \s* $ )' # horizontal line line = r'(?P<line> ^ \s* $ )' # empty line that separates paragraphs head = r'''(?P<head> ^ \s* (?P<head_head>=+) \s* (?P<head_text> .*? ) \s* (?P<head_tail>=*) \s* $ )''' text = r'(?P<text> .+ )' list = r'''(?P<list> ^ [ \t]* ([*][^*\#]|[\#][^\#*]).* $ ( \n[ \t]* [*\#]+.* $ )* )''' # Matches the whole list, separate items are parsed later. The # list *must* start with a single bullet. item = r'''(?P<item> ^ \s* (?P<item_head> [\#*]+) \s* (?P<item_text> .*?) $ )''' # Matches single list items pre = r'''(?P<pre> ^{{{ \s* $ (\n)? (?P<pre_text> ([\#]!(?P<pre_kind>\w*?)(\s+.*)?$)? (.|\n)+? ) (\n)? ^}}} \s*$ )''' pre_escape = r' ^(?P<indent>\s*) ~ (?P<rest> \}\}\} \s*) $' table = r'''(?P<table> ^ \s* [|].*? \s* [|]? \s* $ )''' # For splitting table cells: cell = r''' \| \s* ( (?P<head> [=][^|]+ ) | (?P<cell> ( %s | [^|])+ ) ) \s* ''' % '|'.join([link, macro, image, code]) def __init__(self, bloglike_lines=False, url_protocols=None, wiki_words=False): c = re.compile # For pre escaping, in creole 1.0 done with ~: self.pre_escape_re = c(self.pre_escape, re.M | re.X) # for link descriptions self.link_re = c('|'.join([self.image, self.linebreak, self.char]), re.X | re.U) # for list items self.item_re = c(self.item, re.X | re.U | re.M) # for table cells self.cell_re = c(self.cell, re.X | re.U) # For block elements: if bloglike_lines: self.text = r'(?P<text> .+ ) (?P<break> (?<!\\)$\n(?!\s*$) )?' self.block_re = c('|'.join([self.line, self.head, self.separator, self.pre, self.list, self.table, self.text]), re.X | re.U | re.M) # For inline elements: if url_protocols is not None: self.proto = '|'.join(re.escape(p) for p in url_protocols) self.url = r'''(?P<url> (^ | (?<=\s | [.,:;!?()/=])) (?P<escaped_url>~)? (?P<url_target> (?P<url_proto> %s ):\S+? ) ($ | (?=\s | [,.:;!?()] (\s | $))))''' % self.proto inline_elements = [self.link, self.url, self.macro, self.code, self.image, self.strong, self.emph, self.linebreak, self.escape, self.char] if wiki_words: import unicodedata up_case = u''.join(unichr(i) for i in xrange(sys.maxunicode) if unicodedata.category(unichr(i))=='Lu') self.wiki = ur'''(?P<wiki>[%s]\w+[%s]\w+)''' % (up_case, up_case) inline_elements.insert(3, self.wiki) self.inline_re = c('|'.join(inline_elements), re.X | re.U)
00eadeyemi-clone
rules.py
Python
mit
4,965
from Tkinter import * class AutoScrollbar(Scrollbar): def __init__(self, master=None, cnf={}, **kw): self.container = kw.pop('container', None) self.row = kw.pop('row', 0) self.column = kw.pop('column', 0) self.sticky = kw.pop('sticky', '') Scrollbar.__init__(self, master, cnf, **kw) # a scrollbar that hides itself if it's not needed. only # works if you use the grid geometry manager. def set(self, lo, hi): if float(lo) <= 0.0 and float(hi) >= 1.0: # grid_remove is currently missing from Tkinter! self.tk.call('grid', 'remove', self) else: if not self.container: self.grid() else: self.grid(in_=self.container, row=self.row, column=self.column, sticky=self.sticky) Scrollbar.set(self, lo, hi) def pack(self, **kw): raise TclError, 'cannot use pack with this widget' def place(self, **kw): raise TclError, 'cannot use place with this widget'
00eadeyemi-clone
autoscrollbar.py
Python
mit
1,086
import games import copy import multiprocessing import time import random from controller import Controller from transpositiontable import TranspositionTable from globalconst import * class AlphaBetaController(Controller): def __init__(self, **props): self._model = props['model'] self._view = props['view'] self._end_turn_event = props['end_turn_event'] self._highlights = [] self._search_time = props['searchtime'] # in seconds self._before_turn_event = None self._parent_conn, self._child_conn = multiprocessing.Pipe() self._term_event = multiprocessing.Event() self.process = multiprocessing.Process() self._start_time = None self._call_id = 0 self._trans_table = TranspositionTable(50000) def set_before_turn_event(self, evt): self._before_turn_event = evt def add_highlights(self): for h in self._highlights: self._view.highlight_square(h, OUTLINE_COLOR) def remove_highlights(self): for h in self._highlights: self._view.highlight_square(h, DARK_SQUARES) def start_turn(self): if self._model.terminal_test(): self._before_turn_event() self._model.curr_state.attach(self._view) return self._view.update_statusbar('Thinking ...') self.process = multiprocessing.Process(target=calc_move, args=(self._model, self._trans_table, self._search_time, self._term_event, self._child_conn)) self._start_time = time.time() self.process.daemon = True self.process.start() self._view.canvas.after(100, self.get_move) def get_move(self): #if self._term_event.is_set() and self._model.curr_state.ok_to_move: # self._end_turn_event() # return self._highlights = [] moved = self._parent_conn.poll() while (not moved and (time.time() - self._start_time) < self._search_time * 2): self._call_id = self._view.canvas.after(500, self.get_move) return self._view.canvas.after_cancel(self._call_id) move = self._parent_conn.recv() #if self._model.curr_state.ok_to_move: self._before_turn_event() # highlight remaining board squares used in move step = 2 if len(move.affected_squares) > 2 else 1 for m in move.affected_squares[0::step]: idx = m[0] self._view.highlight_square(idx, OUTLINE_COLOR) self._highlights.append(idx) self._model.curr_state.attach(self._view) self._model.make_move(move, None, True, True, self._view.get_annotation()) # a new move obliterates any more redo's along a branch of the game tree self._model.curr_state.delete_redo_list() self._end_turn_event() def set_search_time(self, time): self._search_time = time # in seconds def stop_process(self): self._term_event.set() self._view.canvas.after_cancel(self._call_id) def end_turn(self): self._view.update_statusbar() self._model.curr_state.detach(self._view) def longest_of(moves): length = -1 selected = None for move in moves: l = len(move.affected_squares) if l > length: length = l selected = move return selected def calc_move(model, table, search_time, term_event, child_conn): move = None term_event.clear() captures = model.captures_available() if captures: time.sleep(0.7) move = longest_of(captures) else: depth = 0 start_time = time.time() curr_time = start_time checkpoint = start_time model_copy = copy.deepcopy(model) while 1: depth += 1 table.set_hash_move(depth, -1) move = games.alphabeta_search(model_copy.curr_state, model_copy, depth) checkpoint = curr_time curr_time = time.time() rem_time = search_time - (curr_time - checkpoint) if term_event.is_set(): # a signal means terminate term_event.clear() move = None break if (curr_time - start_time > search_time or ((curr_time - checkpoint) * 2) > rem_time or depth > MAXDEPTH): break child_conn.send(move) #model.curr_state.ok_to_move = True
00eadeyemi-clone
alphabetacontroller.py
Python
mit
4,964
from goal import Goal from composite import CompositeGoal class Goal_OneKingAttack(CompositeGoal): def __init__(self, owner): CompositeGoal.__init__(self, owner) def activate(self): self.status = self.ACTIVE self.removeAllSubgoals() # because goals are *pushed* onto the front of the subgoal list they must # be added in reverse order. self.addSubgoal(Goal_MoveTowardEnemy(self.owner)) self.addSubgoal(Goal_PinEnemy(self.owner)) def process(self): self.activateIfInactive() return self.processSubgoals() def terminate(self): self.status = self.INACTIVE class Goal_MoveTowardEnemy(Goal): def __init__(self, owner): Goal.__init__(self, owner) def activate(self): self.status = self.ACTIVE def process(self): # if status is inactive, activate self.activateIfInactive() # only moves (not captures) are a valid goal if self.owner.captures: self.status = self.FAILED return # identify player king and enemy king plr_color = self.owner.to_move enemy_color = self.owner.enemy player = self.owner.get_pieces(plr_color)[0] p_idx, _ = player p_row, p_col = self.owner.row_col_for_index(p_idx) enemy = self.owner.get_pieces(enemy_color)[0] e_idx, _ = enemy e_row, e_col = self.owner.row_col_for_index(e_idx) # if distance between player and enemy is already down # to 2 rows or cols, then goal is complete. if abs(p_row - e_row) == 2 or abs(p_col - e_col) == 2: self.status = self.COMPLETED # select the available move that decreases the distance # between the player and the enemy. If no such move exists, # the goal has failed. good_move = None for m in self.owner.moves: # try a move and gather the new row & col for the player self.owner.make_move(m, False, False) plr_update = self.owner.get_pieces(plr_color)[0] pu_idx, _ = plr_update pu_row, pu_col = self.owner.row_col_for_index(pu_idx) self.owner.undo_move(m, False, False) new_diff = abs(pu_row - e_row) + abs(pu_col - e_col) old_diff = abs(p_row - e_row) + abs(p_col - e_col) if new_diff < old_diff: good_move = m break if good_move: self.owner.make_move(good_move, True, True) else: self.status = self.FAILED def terminate(self): self.status = self.INACTIVE class Goal_PinEnemy(Goal): def __init__(self, owner): Goal.__init__(self, owner) def activate(self): self.status = self.ACTIVE def process(self): # for now, I'm not even sure I need this goal, but I'm saving it # as a placeholder. self.status = self.COMPLETED def terminate(self): self.status = self.INACTIVE
00eadeyemi-clone
onekingattack.py
Python
mit
3,153
import math, os, sys from ConfigParser import RawConfigParser DEFAULT_SIZE = 400 BOARD_SIZE = 8 CHECKER_SIZE = 30 MAX_VALID_SQ = 32 MOVE = 0 JUMP = 1 OCCUPIED = 0 BLACK = 1 WHITE = 2 MAN = 4 KING = 8 FREE = 16 COLORS = BLACK | WHITE TYPES = OCCUPIED | BLACK | WHITE | MAN | KING | FREE HUMAN = 0 COMPUTER = 1 MIN = 0 MAX = 1 IMAGE_DIR = 'images' + os.sep RAVEN_ICON = IMAGE_DIR + '_raven.ico' BULLET_IMAGE = IMAGE_DIR + 'bullet_green.gif' CROWN_IMAGE = IMAGE_DIR + 'crown.gif' BOLD_IMAGE = IMAGE_DIR + 'text_bold.gif' ITALIC_IMAGE = IMAGE_DIR + 'text_italic.gif' BULLETS_IMAGE = IMAGE_DIR + 'text_list_bullets.gif' NUMBERS_IMAGE = IMAGE_DIR + 'text_list_numbers.gif' ADDLINK_IMAGE = IMAGE_DIR + 'link.gif' REMLINK_IMAGE = IMAGE_DIR + 'link_break.gif' UNDO_IMAGE = IMAGE_DIR + 'resultset_previous.gif' UNDOALL_IMAGE = IMAGE_DIR + 'resultset_first.gif' REDO_IMAGE = IMAGE_DIR + 'resultset_next.gif' REDOALL_IMAGE = IMAGE_DIR + 'resultset_last.gif' LIGHT_SQUARES = 'tan' DARK_SQUARES = 'dark green' OUTLINE_COLOR = 'white' LIGHT_CHECKERS = 'white' DARK_CHECKERS = 'red' WHITE_CHAR = 'w' WHITE_KING = 'W' BLACK_CHAR = 'b' BLACK_KING = 'B' FREE_CHAR = '.' OCCUPIED_CHAR = '-' INFINITY = 9999999 MAXDEPTH = 10 VERSION = '0.4' TITLE = 'Raven ' + VERSION PROGRAM_TITLE = 'Raven Checkers' CUR_DIR = sys.path[0] TRAINING_DIR = 'training' # search values for transposition table hashfALPHA, hashfBETA, hashfEXACT = range(3) # constants for evaluation function TURN = 2 # color to move gets + turn BRV = 3 # multiplier for back rank KCV = 5 # multiplier for kings in center MCV = 1 # multiplier for men in center MEV = 1 # multiplier for men on edge KEV = 5 # multiplier for kings on edge CRAMP = 5 # multiplier for cramp OPENING = 2 # multipliers for tempo MIDGAME = -1 ENDGAME = 2 INTACTDOUBLECORNER = 3 BLACK_IDX = [5,6] WHITE_IDX = [-5,-6] KING_IDX = [-6,-5,5,6] FIRST = 0 MID = 1 LAST = -1 # (white) # 45 46 47 48 # 39 40 41 42 # 34 35 36 37 # 28 29 30 31 # 23 24 25 26 # 17 18 19 20 # 12 13 14 15 # 6 7 8 9 # (black) # other squares reachable from a particular square with a white man WHITEMAP = {45: set([39,40,34,35,28,29,30,23,24,25,17,18,19,20,12,13,14,15,6,7,8,9]), 46: set([40,41,34,35,36,28,29,30,31,23,24,25,26,17,18,19,20,12,13,14,15,6,7,8,9]), 47: set([41,42,35,36,37,29,30,31,23,24,25,26,17,18,19,20,12,13,14,15,6,7,8,9]), 48: set([42,36,37,30,31,24,25,26,18,19,20,12,13,14,15,6,7,8,9]), 39: set([34,28,29,23,24,17,18,19,12,13,14,6,7,8,9]), 40: set([34,35,28,29,30,23,24,25,17,18,19,20,12,13,14,15,6,7,8,9]), 41: set([35,36,29,30,31,23,24,25,26,17,18,19,20,12,13,14,15,6,7,8,9]), 42: set([36,37,30,31,24,25,26,18,19,20,12,13,14,15,6,7,8,9]), 34: set([28,29,23,24,17,18,19,12,13,14,6,7,8,9]), 35: set([29,30,23,24,25,17,18,19,20,12,13,14,15,6,7,8,9]), 36: set([30,31,24,25,26,18,19,20,12,13,14,15,6,7,8,9]), 37: set([31,25,26,19,20,13,14,15,7,8,9]), 28: set([23,17,18,12,13,6,7,8]), 29: set([23,24,17,18,19,12,13,14,6,7,8,9]), 30: set([24,25,18,19,20,12,13,14,15,6,7,8,9]), 31: set([25,26,19,20,13,14,15,7,8,9]), 23: set([17,18,12,13,6,7,8]), 24: set([18,19,12,13,14,6,7,8,9]), 25: set([19,20,13,14,15,7,8,9]), 26: set([20,14,15,8,9]), 17: set([12,6,7]), 18: set([12,13,6,7,8]), 19: set([13,14,7,8,9]), 20: set([14,15,8,9]), 12: set([6,7]), 13: set([7,8]), 14: set([8,9]), 15: set([9]), 6: set(), 7: set(), 8: set(), 9: set()} # (white) # 45 46 47 48 # 39 40 41 42 # 34 35 36 37 # 28 29 30 31 # 23 24 25 26 # 17 18 19 20 # 12 13 14 15 # 6 7 8 9 # (black) # other squares reachable from a particular square with a black man BLACKMAP = {6: set([12,17,18,23,24,28,29,30,34,35,36,39,40,41,42,45,46,47,48]), 7: set([12,13,17,18,19,23,24,25,28,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 8: set([13,14,18,19,20,23,24,25,26,28,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 9: set([14,15,19,20,24,25,26,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 12: set([17,18,23,24,28,29,30,34,35,36,39,40,41,42,45,46,47,48]), 13: set([18,19,23,24,25,28,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 14: set([19,20,24,25,26,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 15: set([20,25,26,30,31,35,36,37,40,41,42,45,46,47,48]), 17: set([23,28,29,34,35,39,40,41,45,46,47]), 18: set([23,24,28,29,30,34,35,36,39,40,41,42,45,46,47,48]), 19: set([24,25,29,30,31,34,35,36,37,39,40,41,42,45,46,47,48]), 20: set([25,26,30,31,35,36,37,40,41,42,45,46,47,48]), 23: set([28,29,34,35,39,40,41,45,46,47]), 24: set([29,30,34,35,36,39,40,41,42,45,46,47,48]), 25: set([30,31,35,36,37,40,41,42,45,46,47,48]), 26: set([31,36,37,41,42,46,47,48]), 28: set([34,39,40,45,46]), 29: set([34,35,39,40,41,45,46,47]), 30: set([35,36,40,41,42,45,46,47,48]), 31: set([36,37,41,42,46,47,48]), 34: set([39,40,45,46]), 35: set([40,41,45,46,47]), 36: set([41,42,46,47,48]), 37: set([42,47,48]), 39: set([45]), 40: set([45,46]), 41: set([46,47]), 42: set([47,48]), 45: set(), 46: set(), 47: set(), 48: set()} # translate from simple input notation to real checkerboard notation IMAP = {'a1': 5, 'c1': 6, 'e1': 7, 'g1': 8, 'b2': 10, 'd2': 11, 'f2': 12, 'h2': 13, 'a3': 14, 'c3': 15, 'e3': 16, 'g3': 17, 'b4': 19, 'd4': 20, 'f4': 21, 'h4': 22, 'a5': 23, 'c5': 24, 'e5': 25, 'g5': 26, 'b6': 28, 'd6': 29, 'f6': 30, 'h6': 31, 'a7': 32, 'c7': 33, 'e7': 34, 'g7': 35, 'b8': 37, 'd8': 38, 'f8': 39, 'h8': 40} CBMAP = {5:4, 6:3, 7:2, 8:1, 10:8, 11:7, 12:6, 13:5, 14:12, 15:11, 16:10, 17:9, 19:16, 20:15, 21:14, 22:13, 23:20, 24:19, 25:18, 26:17, 28:24, 29:23, 30:22, 31:21, 32:28, 33:27, 34:26, 35:25, 37:32, 38:31, 39:30, 40:29} def create_position_map(): """ Maps compressed grid indices xi + yi * 8 to internal board indices """ pos = {} pos[1] = 45; pos[3] = 46; pos[5] = 47; pos[7] = 48 pos[8] = 39; pos[10] = 40; pos[12] = 41; pos[14] = 42 pos[17] = 34; pos[19] = 35; pos[21] = 36; pos[23] = 37 pos[24] = 28; pos[26] = 29; pos[28] = 30; pos[30] = 31 pos[33] = 23; pos[35] = 24; pos[37] = 25; pos[39] = 26 pos[40] = 17; pos[42] = 18; pos[44] = 19; pos[46] = 20 pos[49] = 12; pos[51] = 13; pos[53] = 14; pos[55] = 15 pos[56] = 6; pos[58] = 7; pos[60] = 8; pos[62] = 9 return pos def create_key_map(): """ Maps internal board indices to checkerboard label numbers """ key = {} key[6] = 4; key[7] = 3; key[8] = 2; key[9] = 1 key[12] = 8; key[13] = 7; key[14] = 6; key[15] = 5 key[17] = 12; key[18] = 11; key[19] = 10; key[20] = 9 key[23] = 16; key[24] = 15; key[25] = 14; key[26] = 13 key[28] = 20; key[29] = 19; key[30] = 18; key[31] = 17 key[34] = 24; key[35] = 23; key[36] = 22; key[37] = 21 key[39] = 28; key[40] = 27; key[41] = 26; key[42] = 25 key[45] = 32; key[46] = 31; key[47] = 30; key[48] = 29 return key def create_grid_map(): """ Maps internal board indices to grid (row, col) coordinates """ grd = {} grd[6] = (7,0); grd[7] = (7,2); grd[8] = (7,4); grd[9] = (7,6) grd[12] = (6,1); grd[13] = (6,3); grd[14] = (6,5); grd[15] = (6,7) grd[17] = (5,0); grd[18] = (5,2); grd[19] = (5,4); grd[20] = (5,6) grd[23] = (4,1); grd[24] = (4,3); grd[25] = (4,5); grd[26] = (4,7) grd[28] = (3,0); grd[29] = (3,2); grd[30] = (3,4); grd[31] = (3,6) grd[34] = (2,1); grd[35] = (2,3); grd[36] = (2,5); grd[37] = (2,7) grd[39] = (1,0); grd[40] = (1,2); grd[41] = (1,4); grd[42] = (1,6) grd[45] = (0,1); grd[46] = (0,3); grd[47] = (0,5); grd[48] = (0,7) return grd def flip_dict(m): d = {} keys = [k for k, _ in m.iteritems()] vals = [v for _, v in m.iteritems()] for k, v in zip(vals, keys): d[k] = v return d def reverse_dict(m): d = {} keys = [k for k, _ in m.iteritems()] vals = [v for _, v in m.iteritems()] for k, v in zip(keys, reversed(vals)): d[k] = v return d def similarity(pattern, pieces): global grid p1 = [grid[i] for i in pattern] p2 = [grid[j] for j in pieces] return sum(min(math.hypot(x1-x2, y1-y2) for x1, y1 in p1) for x2, y2 in p2) def get_preferences_from_file(): config = RawConfigParser() if not os.access('raven.ini',os.F_OK): # no .ini file yet, so make one config.add_section('AnnotationWindow') config.set('AnnotationWindow', 'font', 'Arial') config.set('AnnotationWindow', 'size', '12') # Writing our configuration file to 'raven.ini' with open('raven.ini', 'wb') as configfile: config.write(configfile) config.read('raven.ini') font = config.get('AnnotationWindow', 'font') size = config.get('AnnotationWindow', 'size') return font, size def write_preferences_to_file(font, size): config = RawConfigParser() config.add_section('AnnotationWindow') config.set('AnnotationWindow', 'font', font) config.set('AnnotationWindow', 'size', size) # Writing our configuration file to 'raven.ini' with open('raven.ini', 'wb') as configfile: config.write(configfile) def parse_index(idx): line, _, char = idx.partition('.') return int(line), int(char) def to_string(line, char): return "%d.%d" % (line, char) grid = create_grid_map() keymap = create_key_map() squaremap = flip_dict(keymap)
00eadeyemi-clone
globalconst.py
Python
mit
10,575
import os from Tkinter import * from Tkconstants import END, N, S, E, W from command import * from observer import * from globalconst import * from autoscrollbar import AutoScrollbar from textserialize import Serializer from hyperlinkmgr import HyperlinkManager from tkFileDialog import askopenfilename from tkFont import Font from tooltip import ToolTip class BoardView(Observer): def __init__(self, root, **props): self._statusbar = props['statusbar'] self.root = root self._model = props['model'] self._model.curr_state.attach(self) self._gameMgr = props['parent'] self._board_side = props.get('side') or DEFAULT_SIZE self.light_squares = props.get('lightsquares') or LIGHT_SQUARES self.dark_squares = props.get('darksquares') or DARK_SQUARES self.light_color = props.get('lightcheckers') or LIGHT_CHECKERS self.dark_color = props.get('darkcheckers') or DARK_CHECKERS self._square_size = self._board_side / 8 self._piece_offset = self._square_size / 5 self._crownpic = PhotoImage(file=CROWN_IMAGE) self._boardpos = create_position_map() self._gridpos = create_grid_map() self.canvas = Canvas(root, width=self._board_side, height=self._board_side, borderwidth=0, highlightthickness=0) right_panel = Frame(root, borderwidth=1, relief='sunken') self.toolbar = Frame(root) font, size = get_preferences_from_file() self.scrollbar = AutoScrollbar(root, container=right_panel, row=1, column=1, sticky='ns') self.txt = Text(root, width=40, height=1, borderwidth=0, font=(font,size), wrap='word', yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.txt.yview) self.canvas.pack(side='left', fill='both', expand=False) self.toolbar.grid(in_=right_panel, row=0, column=0, sticky='ew') right_panel.pack(side='right', fill='both', expand=True) self.txt.grid(in_=right_panel, row=1, column=0, sticky='nsew') right_panel.grid_rowconfigure(1, weight=1) right_panel.grid_columnconfigure(0, weight=1) self.init_images() self.init_toolbar_buttons() self.init_font_sizes(font, size) self.init_tags() self._register_event_handlers() self.btnset = set([self.bold, self.italic, self.addLink, self.remLink]) self.btnmap = {'bold': self.bold, 'italic': self.italic, 'bullet': self.bullets, 'number': self.numbers, 'hyper': self.addLink} self.hypermgr = HyperlinkManager(self.txt, self._gameMgr.load_game) self.serializer = Serializer(self.txt, self.hypermgr) self.curr_annotation = '' self._setup_board(root) starting_squares = [i for i in self._model.curr_state.valid_squares if self._model.curr_state.squares[i] & (BLACK | WHITE)] self._draw_checkers(Command(add=starting_squares)) self.flip_view = False # black on bottom self._label_board() self.update_statusbar() def _toggle_state(self, tags, btn): # toggle the text state based on the first character in the # selected range. if self.txt.tag_ranges('sel'): current_tags = self.txt.tag_names('sel.first') elif self.txt.tag_ranges('insert'): current_tags = self.txt.tag_names('insert') else: return for tag in tags: already_tagged = any((x for x in current_tags if x.startswith(tag))) for t in current_tags: if t != 'sel': self.txt.tag_remove(t, 'sel.first', 'sel.last') if not already_tagged: self.txt.tag_add(tag, 'sel.first', 'sel.last') btn.configure(relief='sunken') other_btns = self.btnset.difference([btn]) for b in other_btns: b.configure(relief='raised') else: btn.configure(relief='raised') def _on_bold(self): self.bold_tooltip.hide() self._toggle_state(['bold'], self.bold) def _on_italic(self): self.italic_tooltip.hide() self._toggle_state(['italic'], self.italic) def _on_bullets(self): self._process_button_click('bullet', self.bullets_tooltip, self._add_bullets_if_needed, self._remove_bullets_if_needed) def _on_numbers(self): self._process_button_click('number', self.numbers_tooltip, self._add_numbers_if_needed, self._remove_numbers_if_needed) def _process_button_click(self, tag, tooltip, add_func, remove_func): tooltip.hide() if self.txt.tag_ranges('sel'): startline, _ = parse_index(self.txt.index('sel.first')) endline, _ = parse_index(self.txt.index('sel.last')) else: startline, _ = parse_index(self.txt.index(INSERT)) endline = startline current_tags = self.txt.tag_names('%d.0' % startline) if tag not in current_tags: add_func(startline, endline) else: remove_func(startline, endline) def _add_bullets_if_needed(self, startline, endline): self._remove_numbers_if_needed(startline, endline) for line in range(startline, endline+1): current_tags = self.txt.tag_names('%d.0' % line) if 'bullet' not in current_tags: start = '%d.0' % line end = '%d.end' % line self.txt.insert(start, '\t') self.txt.image_create(start, image=self.bullet_image) self.txt.insert(start, '\t') self.txt.tag_add('bullet', start, end) self.bullets.configure(relief='sunken') self.numbers.configure(relief='raised') def _remove_bullets_if_needed(self, startline, endline): for line in range(startline, endline+1): current_tags = self.txt.tag_names('%d.0' % line) if 'bullet' in current_tags: start = '%d.0' % line end = '%d.end' % line self.txt.tag_remove('bullet', start, end) start = '%d.0' % line end = '%d.3' % line self.txt.delete(start, end) self.bullets.configure(relief='raised') def _add_numbers_if_needed(self, startline, endline): self._remove_bullets_if_needed(startline, endline) num = 1 for line in range(startline, endline+1): current_tags = self.txt.tag_names('%d.0' % line) if 'number' not in current_tags: start = '%d.0' % line end = '%d.end' % line self.txt.insert(start, '\t') numstr = '%d.' % num self.txt.insert(start, numstr) self.txt.insert(start, '\t') self.txt.tag_add('number', start, end) num += 1 self.numbers.configure(relief='sunken') self.bullets.configure(relief='raised') def _remove_numbers_if_needed(self, startline, endline): cnt = IntVar() for line in range(startline, endline+1): current_tags = self.txt.tag_names('%d.0' % line) if 'number' in current_tags: start = '%d.0' % line end = '%d.end' % line self.txt.tag_remove('number', start, end) # Regex to match a tab, followed by any number of digits, # followed by a period, all at the start of a line. # The cnt variable stores the number of characters matched. pos = self.txt.search('^\t\d+\.\t', start, end, None, None, None, True, None, cnt) if pos: end = '%d.%d' % (line, cnt.get()) self.txt.delete(start, end) self.numbers.configure(relief='raised') def _on_undo(self): self.undo_tooltip.hide() self._gameMgr.parent.undo_single_move() def _on_undo_all(self): self.undoall_tooltip.hide() self._gameMgr.parent.undo_all_moves() def _on_redo(self): self.redo_tooltip.hide() self._gameMgr.parent.redo_single_move() def _on_redo_all(self): self.redoall_tooltip.hide() self._gameMgr.parent.redo_all_moves() def _on_add_link(self): filename = askopenfilename(initialdir='training') if filename: filename = os.path.relpath(filename, CUR_DIR) self._toggle_state(self.hypermgr.add(filename), self.addLink) def _on_remove_link(self): if self.txt.tag_ranges('sel'): current_tags = self.txt.tag_names('sel.first') if 'hyper' in current_tags: self._toggle_state(['hyper'], self.addLink) def _register_event_handlers(self): self.txt.event_add('<<KeyRel>>', '<KeyRelease-Home>', '<KeyRelease-End>', '<KeyRelease-Left>', '<KeyRelease-Right>', '<KeyRelease-Up>', '<KeyRelease-Down>', '<KeyRelease-Delete>', '<KeyRelease-BackSpace>') Widget.bind(self.txt, '<<Selection>>', self._sel_changed) Widget.bind(self.txt, '<ButtonRelease-1>', self._sel_changed) Widget.bind(self.txt, '<<KeyRel>>', self._key_release) def _key_release(self, event): line, char = parse_index(self.txt.index(INSERT)) self.update_button_state(to_string(line, char)) def _sel_changed(self, event): self.update_button_state(self.txt.index(INSERT)) def is_dirty(self): return self.curr_annotation != self.get_annotation() def reset_toolbar_buttons(self): for btn in self.btnset: btn.configure(relief='raised') def update_button_state(self, index): if self.txt.tag_ranges('sel'): current_tags = self.txt.tag_names('sel.first') else: current_tags = self.txt.tag_names(index) for btn in self.btnmap.itervalues(): btn.configure(relief='raised') for tag in current_tags: if tag in self.btnmap.keys(): self.btnmap[tag].configure(relief='sunken') def init_font_sizes(self, font, size): self.txt.config(font=[font, size]) self._b_font = Font(self.root, (font, size, 'bold')) self._i_font = Font(self.root, (font, size, 'italic')) def init_tags(self): self.txt.tag_config('bold', font=self._b_font, wrap='word') self.txt.tag_config('italic', font=self._i_font, wrap='word') self.txt.tag_config('number', tabs='.5c center 1c left', lmargin1='0', lmargin2='1c') self.txt.tag_config('bullet', tabs='.5c center 1c left', lmargin1='0', lmargin2='1c') def init_images(self): self.bold_image = PhotoImage(file=BOLD_IMAGE) self.italic_image = PhotoImage(file=ITALIC_IMAGE) self.addlink_image = PhotoImage(file=ADDLINK_IMAGE) self.remlink_image = PhotoImage(file=REMLINK_IMAGE) self.bullets_image = PhotoImage(file=BULLETS_IMAGE) self.bullet_image = PhotoImage(file=BULLET_IMAGE) self.numbers_image = PhotoImage(file=NUMBERS_IMAGE) self.undo_image = PhotoImage(file=UNDO_IMAGE) self.undoall_image= PhotoImage(file=UNDOALL_IMAGE) self.redo_image = PhotoImage(file=REDO_IMAGE) self.redoall_image = PhotoImage(file=REDOALL_IMAGE) def init_toolbar_buttons(self): self.bold = Button(name='bold', image=self.bold_image, borderwidth=1, command=self._on_bold) self.bold.grid(in_=self.toolbar, row=0, column=0, sticky=W) self.italic = Button(name='italic', image=self.italic_image, borderwidth=1, command=self._on_italic) self.italic.grid(in_=self.toolbar, row=0, column=1, sticky=W) self.bullets = Button(name='bullets', image=self.bullets_image, borderwidth=1, command=self._on_bullets) self.bullets.grid(in_=self.toolbar, row=0, column=2, sticky=W) self.numbers = Button(name='numbers', image=self.numbers_image, borderwidth=1, command=self._on_numbers) self.numbers.grid(in_=self.toolbar, row=0, column=3, sticky=W) self.addLink = Button(name='addlink', image=self.addlink_image, borderwidth=1, command=self._on_add_link) self.addLink.grid(in_=self.toolbar, row=0, column=4, sticky=W) self.remLink = Button(name='remlink', image=self.remlink_image, borderwidth=1, command=self._on_remove_link) self.remLink.grid(in_=self.toolbar, row=0, column=5, sticky=W) self.frame = Frame(width=0) self.frame.grid(in_=self.toolbar, padx=5, row=0, column=6, sticky=W) self.undoall = Button(name='undoall', image=self.undoall_image, borderwidth=1, command=self._on_undo_all) self.undoall.grid(in_=self.toolbar, row=0, column=7, sticky=W) self.undo = Button(name='undo', image=self.undo_image, borderwidth=1, command=self._on_undo) self.undo.grid(in_=self.toolbar, row=0, column=8, sticky=W) self.redo = Button(name='redo', image=self.redo_image, borderwidth=1, command=self._on_redo) self.redo.grid(in_=self.toolbar, row=0, column=9, sticky=W) self.redoall = Button(name='redoall', image=self.redoall_image, borderwidth=1, command=self._on_redo_all) self.redoall.grid(in_=self.toolbar, row=0, column=10, sticky=W) self.bold_tooltip = ToolTip(self.bold, 'Bold') self.italic_tooltip = ToolTip(self.italic, 'Italic') self.bullets_tooltip = ToolTip(self.bullets, 'Bullet list') self.numbers_tooltip = ToolTip(self.numbers, 'Numbered list') self.addlink_tooltip = ToolTip(self.addLink, 'Add hyperlink') self.remlink_tooltip = ToolTip(self.remLink, 'Remove hyperlink') self.undoall_tooltip = ToolTip(self.undoall, 'First move') self.undo_tooltip = ToolTip(self.undo, 'Back one move') self.redo_tooltip = ToolTip(self.redo, 'Forward one move') self.redoall_tooltip = ToolTip(self.redoall, 'Last move') def reset_view(self, model): self._model = model self.txt.delete('1.0', END) sq = self._model.curr_state.valid_squares self.canvas.delete(self.dark_color) self.canvas.delete(self.light_color) starting_squares = [i for i in sq if (self._model.curr_state.squares[i] & (BLACK | WHITE))] self._draw_checkers(Command(add=starting_squares)) for i in sq: self.highlight_square(i, DARK_SQUARES) def calc_board_loc(self, x, y): vx, vy = self.calc_valid_xy(x, y) xi = int(vx / self._square_size) yi = int(vy / self._square_size) return xi, yi def calc_board_pos(self, xi, yi): return self._boardpos.get(xi + yi * 8, 0) def calc_grid_pos(self, pos): return self._gridpos[pos] def highlight_square(self, idx, color): row, col = self._gridpos[idx] hpos = col + row * 8 self.canvas.itemconfigure('o'+str(hpos), outline=color) def calc_valid_xy(self, x, y): return (min(max(0, self.canvas.canvasx(x)), self._board_side-1), min(max(0, self.canvas.canvasy(y)), self._board_side-1)) def notify(self, move): add_lst = [] rem_lst = [] for idx, _, newval in move.affected_squares: if newval & FREE: rem_lst.append(idx) else: add_lst.append(idx) cmd = Command(add=add_lst, remove=rem_lst) self._draw_checkers(cmd) self.txt.delete('1.0', END) self.serializer.restore(move.annotation) self.curr_annotation = move.annotation if self.txt.get('1.0','end').strip() == '': start = keymap[move.affected_squares[FIRST][0]] dest = keymap[move.affected_squares[LAST][0]] movestr = '%d-%d' % (start, dest) self.txt.insert('1.0', movestr) def get_annotation(self): return self.serializer.dump() def erase_checker(self, index): self.canvas.delete('c'+str(index)) def flip_board(self, flip): self._delete_labels() self.canvas.delete(self.dark_color) self.canvas.delete(self.light_color) if self.flip_view != flip: self.flip_view = flip self._gridpos = reverse_dict(self._gridpos) self._boardpos = reverse_dict(self._boardpos) self._label_board() starting_squares = [i for i in self._model.curr_state.valid_squares if self._model.curr_state.squares[i] & (BLACK | WHITE)] all_checkers = Command(add=starting_squares) self._draw_checkers(all_checkers) def update_statusbar(self, output=None): if output: self._statusbar['text'] = output self.root.update() return if self._model.terminal_test(): text = "Game over. " if self._model.curr_state.to_move == WHITE: text += "Black won." else: text += "White won." self._statusbar['text'] = text return if self._model.curr_state.to_move == WHITE: self._statusbar['text'] = "White to move" else: self._statusbar['text'] = "Black to move" def get_positions(self, type): return map(str, sorted((keymap[i] for i in self._model.curr_state.valid_squares if self._model.curr_state.squares[i] == type))) # private functions def _setup_board(self, root): for r in range(0, 8, 2): row = r * self._square_size for c in range(0, 8, 2): col = c * self._square_size self.canvas.create_rectangle(col, row, col+self._square_size-1, row+self._square_size-1, fill=LIGHT_SQUARES, outline=LIGHT_SQUARES) for c in range(1, 8, 2): col = c * self._square_size self.canvas.create_rectangle(col, row+self._square_size, col+self._square_size-1, row+self._square_size*2-1, fill=LIGHT_SQUARES, outline=LIGHT_SQUARES) for r in range(0, 8, 2): row = r * self._square_size for c in range(1, 8, 2): col = c * self._square_size self.canvas.create_rectangle(col, row, col+self._square_size-1, row+self._square_size-1, fill=DARK_SQUARES, outline=DARK_SQUARES, tags='o'+str(r*8+c)) for c in range(0, 8, 2): col = c * self._square_size self.canvas.create_rectangle(col, row+self._square_size, col+self._square_size-1, row+self._square_size*2-1, fill=DARK_SQUARES, outline=DARK_SQUARES, tags='o'+str(((r+1)*8)+c)) def _label_board(self): for key, pair in self._gridpos.iteritems(): row, col = pair xpos, ypos = col * self._square_size, row * self._square_size self.canvas.create_text(xpos+self._square_size-7, ypos+self._square_size-7, text=str(keymap[key]), fill=LIGHT_SQUARES, tag='label') def _delete_labels(self): self.canvas.delete('label') def _draw_checkers(self, change): if change == None: return for i in change.remove: self.canvas.delete('c'+str(i)) for i in change.add: checker = self._model.curr_state.squares[i] color = self.dark_color if checker & COLORS == BLACK else self.light_color row, col = self._gridpos[i] x = col * self._square_size + self._piece_offset y = row * self._square_size + self._piece_offset tag = 'c'+str(i) self.canvas.create_oval(x+2, y+2, x+2+CHECKER_SIZE, y+2+CHECKER_SIZE, outline='black', fill='black', tags=(color, tag)) self.canvas.create_oval(x, y, x+CHECKER_SIZE, y+CHECKER_SIZE, outline='black', fill=color, tags=(color, tag)) if checker & KING: self.canvas.create_image(x+15, y+15, image=self._crownpic, anchor=CENTER, tags=(color, tag))
00eadeyemi-clone
boardview.py
Python
mit
22,356
import sys import games from globalconst import * class Player(object): def __init__(self, color): self.col = color def _get_color(self): return self.col color = property(_get_color, doc="Player color") class AlphabetaPlayer(Player): def __init__(self, color, depth=4): Player.__init__(self, color) self.searchDepth = depth def select_move(self, game, state): sys.stdout.write('\nThinking ... ') movelist = games.alphabeta_search(state, game, False, self.searchDepth) positions = [] step = 2 if game.captures_available(state) else 1 for i in range(0, len(movelist), step): idx, old, new = movelist[i] positions.append(str(CBMAP[idx])) move = '-'.join(positions) print 'I move %s' % move return movelist class HumanPlayer(Player): def __init__(self, color): Player.__init__(self, color) def select_move(self, game, state): while 1: moves = game.legal_moves(state) positions = [] idx = 0 while 1: reqstr = 'Move to? ' if positions else 'Move from? ' # do any positions match the input pos = self._valid_pos(raw_input(reqstr), moves, idx) if pos: positions.append(pos) # reduce moves to number matching the positions entered moves = self._filter_moves(pos, moves, idx) if game.captures_available(state): idx += 2 else: idx += 1 if len(moves) <= 1: break if len(moves) == 1: return moves[0] else: print "Illegal move!" def _valid_pos(self, pos, moves, idx): t_pos = IMAP.get(pos.lower(), 0) if t_pos == 0: return None # move is illegal for m in moves: if idx < len(m) and m[idx][0] == t_pos: return t_pos return None def _filter_moves(self, pos, moves, idx): del_list = [] for i, m in enumerate(moves): if pos != m[idx][0]: del_list.append(i) for i in reversed(del_list): del moves[i] return moves
00eadeyemi-clone
player.py
Python
mit
2,496
from UserDict import UserDict class TranspositionTable (UserDict): def __init__ (self, maxSize): UserDict.__init__(self) assert maxSize > 0 self.maxSize = maxSize self.krono = [] self.maxdepth = 0 self.killer1 = [-1]*20 self.killer2 = [-1]*20 self.hashmove = [-1]*20 def __setitem__ (self, key, item): if not key in self: if len(self) >= self.maxSize: try: del self[self.krono[0]] except KeyError: pass # Overwritten del self.krono[0] self.data[key] = item self.krono.append(key) def probe (self, hash, depth, alpha, beta): if not hash in self: return move, score, hashf, ply = self[hash] if ply < depth: return if hashf == hashfEXACT: return move, score, hashf if hashf == hashfALPHA and score <= alpha: return move, alpha, hashf if hashf == hashfBETA and score >= beta: return move, beta, hashf def record (self, hash, move, score, hashf, ply): self[hash] = (move, score, hashf, ply) def add_killer (self, ply, move): if self.killer1[ply] == -1: self.killer1[ply] = move elif move != self.killer1[ply]: self.killer2[ply] = move def is_killer (self, ply, move): if self.killer1[ply] == move: return 10 elif self.killer2[ply] == move: return 8 if ply >= 2: if self.killer1[ply-2] == move: return 6 elif self.killer2[ply-2] == move: return 4 return 0 def set_hash_move (self, ply, move): self.hashmove[ply] = move def is_hash_move (self, ply, move): return self.hashmove[ply] == move
00eadeyemi-clone
transpositiontable.py
Python
mit
1,897
import re import sys from rules import Rules from document import DocNode class Parser(object): """ Parse the raw text and create a document object that can be converted into output using Emitter. A separate instance should be created for parsing a new document. The first parameter is the raw text to be parsed. An optional second argument is the Rules object to use. You can customize the parsing rules to enable optional features or extend the parser. """ def __init__(self, raw, rules=None): self.rules = rules or Rules() self.raw = raw self.root = DocNode('document', None) self.cur = self.root # The most recent document node self.text = None # The node to add inline characters to def _upto(self, node, kinds): """ Look up the tree to the first occurence of one of the listed kinds of nodes or root. Start at the node node. """ while node.parent is not None and not node.kind in kinds: node = node.parent return node # The _*_repl methods called for matches in regexps. Sometimes the # same method needs several names, because of group names in regexps. def _url_repl(self, groups): """Handle raw urls in text.""" if not groups.get('escaped_url'): # this url is NOT escaped target = groups.get('url_target', '') node = DocNode('link', self.cur) node.content = target DocNode('text', node, node.content) self.text = None else: # this url is escaped, we render it as text if self.text is None: self.text = DocNode('text', self.cur, u'') self.text.content += groups.get('url_target') def _link_repl(self, groups): """Handle all kinds of links.""" target = groups.get('link_target', '') text = (groups.get('link_text', '') or '').strip() parent = self.cur self.cur = DocNode('link', self.cur) self.cur.content = target self.text = None self.parse_re(text, self.rules.link_re) self.cur = parent self.text = None def _wiki_repl(self, groups): """Handle WikiWord links, if enabled.""" text = groups.get('wiki', '') node = DocNode('link', self.cur) node.content = text DocNode('text', node, node.content) self.text = None def _macro_repl(self, groups): """Handles macros using the placeholder syntax.""" name = groups.get('macro_name', '') text = (groups.get('macro_text', '') or '').strip() node = DocNode('macro', self.cur, name) node.args = groups.get('macro_args', '') or '' DocNode('text', node, text or name) self.text = None def _image_repl(self, groups): """Handles images and attachemnts included in the page.""" target = groups.get('image_target', '').strip() text = (groups.get('image_text', '') or '').strip() node = DocNode("image", self.cur, target) DocNode('text', node, text or node.content) self.text = None def _separator_repl(self, groups): self.cur = self._upto(self.cur, ('document', 'section', 'blockquote')) DocNode('separator', self.cur) def _item_repl(self, groups): bullet = groups.get('item_head', u'') text = groups.get('item_text', u'') if bullet[-1] == '#': kind = 'number_list' else: kind = 'bullet_list' level = len(bullet) lst = self.cur # Find a list of the same kind and level up the tree while (lst and not (lst.kind in ('number_list', 'bullet_list') and lst.level == level) and not lst.kind in ('document', 'section', 'blockquote')): lst = lst.parent if lst and lst.kind == kind: self.cur = lst else: # Create a new level of list self.cur = self._upto(self.cur, ('list_item', 'document', 'section', 'blockquote')) self.cur = DocNode(kind, self.cur) self.cur.level = level self.cur = DocNode('list_item', self.cur) self.parse_inline(text) self.text = None def _list_repl(self, groups): text = groups.get('list', u'') self.parse_re(text, self.rules.item_re) def _head_repl(self, groups): self.cur = self._upto(self.cur, ('document', 'section', 'blockquote')) node = DocNode('header', self.cur, groups.get('head_text', '').strip()) node.level = len(groups.get('head_head', ' ')) def _text_repl(self, groups): text = groups.get('text', '') if self.cur.kind in ('table', 'table_row', 'bullet_list', 'number_list'): self.cur = self._upto(self.cur, ('document', 'section', 'blockquote')) if self.cur.kind in ('document', 'section', 'blockquote'): self.cur = DocNode('paragraph', self.cur) else: text = u' ' + text self.parse_inline(text) if groups.get('break') and self.cur.kind in ('paragraph', 'emphasis', 'strong', 'code'): DocNode('break', self.cur, '') self.text = None _break_repl = _text_repl def _table_repl(self, groups): row = groups.get('table', '|').strip() self.cur = self._upto(self.cur, ( 'table', 'document', 'section', 'blockquote')) if self.cur.kind != 'table': self.cur = DocNode('table', self.cur) tb = self.cur tr = DocNode('table_row', tb) text = '' for m in self.rules.cell_re.finditer(row): cell = m.group('cell') if cell: self.cur = DocNode('table_cell', tr) self.text = None self.parse_inline(cell) else: cell = m.group('head') self.cur = DocNode('table_head', tr) self.text = DocNode('text', self.cur, u'') self.text.content = cell.strip('=') self.cur = tb self.text = None def _pre_repl(self, groups): self.cur = self._upto(self.cur, ('document', 'section', 'blockquote')) kind = groups.get('pre_kind', None) text = groups.get('pre_text', u'') def remove_tilde(m): return m.group('indent') + m.group('rest') text = self.rules.pre_escape_re.sub(remove_tilde, text) node = DocNode('preformatted', self.cur, text) node.sect = kind or '' self.text = None def _line_repl(self, groups): self.cur = self._upto(self.cur, ('document', 'section', 'blockquote')) def _code_repl(self, groups): DocNode('code', self.cur, groups.get('code_text', u'').strip()) self.text = None def _emph_repl(self, groups): if self.cur.kind != 'emphasis': self.cur = DocNode('emphasis', self.cur) else: self.cur = self._upto(self.cur, ('emphasis', )).parent self.text = None def _strong_repl(self, groups): if self.cur.kind != 'strong': self.cur = DocNode('strong', self.cur) else: self.cur = self._upto(self.cur, ('strong', )).parent self.text = None def _break_repl(self, groups): DocNode('break', self.cur, None) self.text = None def _escape_repl(self, groups): if self.text is None: self.text = DocNode('text', self.cur, u'') self.text.content += groups.get('escaped_char', u'') def _char_repl(self, groups): if self.text is None: self.text = DocNode('text', self.cur, u'') self.text.content += groups.get('char', u'') def parse_inline(self, raw): """Recognize inline elements inside blocks.""" self.parse_re(raw, self.rules.inline_re) def parse_re(self, raw, rules_re): """Parse a fragment according to the compiled rules.""" for match in rules_re.finditer(raw): groups = dict((k, v) for (k, v) in match.groupdict().iteritems() if v is not None) name = match.lastgroup function = getattr(self, '_%s_repl' % name) function(groups) def parse(self): """Parse the text given as self.raw and return DOM tree.""" self.parse_re(self.raw, self.rules.block_re) return self.root
00eadeyemi-clone
creoleparser.py
Python
mit
8,630
from Tkinter import * from ttk import Combobox, Label from tkFont import families from tkSimpleDialog import Dialog class PreferencesDialog(Dialog): def __init__(self, parent, title, font, size): self._master = parent self.result = False self.font = font self.size = size Dialog.__init__(self, parent, title) def body(self, master): self._npFrame = LabelFrame(master, text='Annotation window text') self._npFrame.pack(fill=X) self._fontFrame = Frame(self._npFrame, borderwidth=0) self._fontLabel = Label(self._fontFrame, text='Font:', width=5) self._fontLabel.pack(side=LEFT, padx=3) self._fontCombo = Combobox(self._fontFrame, values=sorted(families()), state='readonly') self._fontCombo.pack(side=RIGHT, fill=X) self._sizeFrame = Frame(self._npFrame, borderwidth=0) self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5) self._sizeLabel.pack(side=LEFT, padx=3) self._sizeCombo = Combobox(self._sizeFrame, values=range(8,15), state='readonly') self._sizeCombo.pack(side=RIGHT, fill=X) self._fontFrame.pack() self._sizeFrame.pack() self._npFrame.pack(fill=X) self._fontCombo.set(self.font) self._sizeCombo.set(self.size) def apply(self): self.font = self._fontCombo.get() self.size = self._sizeCombo.get() self.result = True def cancel(self, event=None): if self.parent is not None: self.parent.focus_set() self.destroy()
00eadeyemi-clone
prefdlg.py
Python
mit
1,691
from Tkinter import PhotoImage from Tkconstants import * from globalconst import BULLET_IMAGE from creoleparser import Parser from rules import LinkRules class TextTagEmitter(object): """ Generate tagged output compatible with the Tkinter Text widget """ def __init__(self, root, txtWidget, hyperMgr, bulletImage, link_rules=None): self.root = root self.link_rules = link_rules or LinkRules() self.txtWidget = txtWidget self.hyperMgr = hyperMgr self.line = 1 self.index = 0 self.number = 1 self.bullet = False self.bullet_image = bulletImage self.begin_italic = '' self.begin_bold = '' self.begin_list_item = '' self.list_item = '' self.begin_link = '' # visit/leave methods for emitting nodes of the document: def visit_document(self, node): pass def leave_document(self, node): # leave_paragraph always leaves two extra carriage returns at the # end of the text. This deletes them. txtindex = '%d.%d' % (self.line-1, self.index) self.txtWidget.delete(txtindex, END) def visit_text(self, node): if self.begin_list_item: self.list_item = node.content elif self.begin_link: pass else: txtindex = '%d.%d' % (self.line, self.index) self.txtWidget.insert(txtindex, node.content) def leave_text(self, node): if not self.begin_list_item: self.index += len(node.content) def visit_separator(self, node): raise NotImplementedError def leave_separator(self, node): raise NotImplementedError def visit_paragraph(self, node): pass def leave_paragraph(self, node): txtindex = '%d.%d' % (self.line, self.index) self.txtWidget.insert(txtindex, '\n\n') self.line += 2 self.index = 0 self.number = 1 def visit_bullet_list(self, node): self.bullet = True def leave_bullet_list(self, node): txtindex = '%d.%d' % (self.line, self.index) self.txtWidget.insert(txtindex, '\n') self.line += 1 self.index = 0 self.bullet = False def visit_number_list(self, node): self.number = 1 def leave_number_list(self, node): txtindex = '%d.%d' % (self.line, self.index) self.txtWidget.insert(txtindex, '\n') self.line += 1 self.index = 0 def visit_list_item(self, node): self.begin_list_item = '%d.%d' % (self.line, self.index) def leave_list_item(self, node): if self.bullet: self.txtWidget.insert(self.begin_list_item, '\t') next = '%d.%d' % (self.line, self.index+1) self.txtWidget.image_create(next, image=self.bullet_image) next = '%d.%d' % (self.line, self.index+2) content = '\t%s\t\n' % self.list_item self.txtWidget.insert(next, content) end_list_item = '%d.%d' % (self.line, self.index + len(content)+2) self.txtWidget.tag_add('bullet', self.begin_list_item, end_list_item) elif self.number: content = '\t%d.\t%s\n' % (self.number, self.list_item) end_list_item = '%d.%d' % (self.line, self.index + len(content)) self.txtWidget.insert(self.begin_list_item, content) self.txtWidget.tag_add('number', self.begin_list_item, end_list_item) self.number += 1 self.begin_list_item = '' self.list_item = '' self.line += 1 self.index = 0 def visit_emphasis(self, node): self.begin_italic = '%d.%d' % (self.line, self.index) def leave_emphasis(self, node): end_italic = '%d.%d' % (self.line, self.index) self.txtWidget.tag_add('italic', self.begin_italic, end_italic) def visit_strong(self, node): self.begin_bold = '%d.%d' % (self.line, self.index) def leave_strong(self, node): end_bold = '%d.%d' % (self.line, self.index) self.txtWidget.tag_add('bold', self.begin_bold, end_bold) def visit_link(self, node): self.begin_link = '%d.%d' % (self.line, self.index) def leave_link(self, node): end_link = '%d.%d' % (self.line, self.index) # TODO: Revisit unicode encode/decode issues later. # 1. Decode early. 2. Unicode everywhere 3. Encode late # However, decoding filename and link_text here works for now. fname = str(node.content).replace('%20', ' ') link_text = str(node.children[0].content).replace('%20', ' ') self.txtWidget.insert(self.begin_link, link_text, self.hyperMgr.add(fname)) self.begin_link = '' def visit_break(self, node): txtindex = '%d.%d' % (self.line, self.index) self.txtWidget.insert(txtindex, '\n') def leave_break(self, node): self.line += 1 self.index = 0 def visit_default(self, node): """Fallback function for visiting unknown nodes.""" raise TypeError def leave_default(self, node): """Fallback function for leaving unknown nodes.""" raise TypeError def emit_children(self, node): """Emit all the children of a node.""" for child in node.children: self.emit_node(child) def emit_node(self, node): """Visit/depart a single node and its children.""" visit = getattr(self, 'visit_%s' % node.kind, self.visit_default) visit(node) self.emit_children(node) leave = getattr(self, 'leave_%s' % node.kind, self.leave_default) leave(node) def emit(self): """Emit the document represented by self.root DOM tree.""" return self.emit_node(self.root) class Serializer(object): def __init__(self, txtWidget, hyperMgr): self.txt = txtWidget self.hyperMgr = hyperMgr self.bullet_image = PhotoImage(file=BULLET_IMAGE) self._reset() def _reset(self): self.number = 0 self.bullet = False self.filename = '' self.link_start = False self.first_tab = True self.list_end = False def dump(self, index1='1.0', index2=END): # outputs contents from Text widget in Creole format. creole = '' self._reset() for key, value, index in self.txt.dump(index1, index2): if key == 'tagon': if value == 'bold': creole += '**' elif value == 'italic': creole += '//' elif value == 'bullet': creole += '*' self.bullet = True self.list_end = False elif value.startswith('hyper-'): self.filename = self.hyperMgr.filenames[value] self.link_start = True elif value == 'number': creole += '#' self.number += 1 elif key == 'tagoff': if value == 'bold': creole += '**' elif value == 'italic': creole += '//' elif value.startswith('hyper-'): creole += ']]' elif value == 'number': numstr = '#\t%d.\t' % self.number if numstr in creole: creole = creole.replace(numstr, '# ', 1) self.list_end = True elif value == 'bullet': creole = creole.replace('\n*\t\t', '\n* ', 1) self.bullet = False self.list_end = True elif key == 'text': if self.link_start: # TODO: Revisit unicode encode/decode issues later. # 1. Decode early. 2. Unicode everywhere 3. Encode late # However, encoding filename and link_text here works for # now. fname = self.filename.replace(' ', '%20').encode('utf-8') link_text = value.replace(' ', '%20') value = '[[%s|%s' % (fname, link_text) self.link_start = False numstr = '%d.\t' % self.number if self.list_end and value != '\n' and numstr not in value: creole += '\n' self.number = 0 self.list_end = False creole += value return creole.rstrip() def restore(self, creole): self.hyperMgr.reset() document = Parser(unicode(creole, 'utf-8', 'ignore')).parse() return TextTagEmitter(document, self.txt, self.hyperMgr, self.bullet_image).emit()
00eadeyemi-clone
textserialize.py
Python
mit
9,098
import os from Tkinter import * from Tkconstants import W, E import Tkinter as tk from tkMessageBox import askyesnocancel from multiprocessing import freeze_support from globalconst import * from aboutbox import AboutBox from setupboard import SetupBoard from gamemanager import GameManager from centeredwindow import CenteredWindow from prefdlg import PreferencesDialog class MainFrame(object, CenteredWindow): def __init__(self, master): self.root = master self.root.withdraw() self.root.iconbitmap(RAVEN_ICON) self.root.title('Raven ' + VERSION) self.root.protocol('WM_DELETE_WINDOW', self._on_close) self.thinkTime = IntVar(value=5) self.manager = GameManager(root=self.root, parent=self) self.menubar = tk.Menu(self.root) self.create_game_menu() self.create_options_menu() self.create_help_menu() self.root.config(menu=self.menubar) CenteredWindow.__init__(self, self.root) self.root.deiconify() def _on_close(self): if self.manager.view.is_dirty(): msg = 'Do you want to save your changes before exiting?' result = askyesnocancel(TITLE, msg) if result == True: self.manager.save_game() elif result == None: return self.root.destroy() def set_title_bar_filename(self, filename=None): if not filename: self.root.title(TITLE) else: self.root.title(TITLE + ' - ' + os.path.basename(filename)) def undo_all_moves(self, *args): self.stop_processes() self.manager.model.undo_all_moves(None, self.manager.view.get_annotation()) self.manager._controller1.remove_highlights() self.manager._controller2.remove_highlights() self.manager.view.update_statusbar() def redo_all_moves(self, *args): self.stop_processes() self.manager.model.redo_all_moves(None, self.manager.view.get_annotation()) self.manager._controller1.remove_highlights() self.manager._controller2.remove_highlights() self.manager.view.update_statusbar() def undo_single_move(self, *args): self.stop_processes() self.manager.model.undo_move(None, None, True, True, self.manager.view.get_annotation()) self.manager._controller1.remove_highlights() self.manager._controller2.remove_highlights() self.manager.view.update_statusbar() def redo_single_move(self, *args): self.stop_processes() annotation = self.manager.view.get_annotation() self.manager.model.redo_move(None, None, annotation) self.manager._controller1.remove_highlights() self.manager._controller2.remove_highlights() self.manager.view.update_statusbar() def create_game_menu(self): game = Menu(self.menubar, tearoff=0) game.add_command(label='New game', underline=0, command=self.manager.new_game) game.add_command(label='Open game ...', underline=0, command=self.manager.open_game) game.add_separator() game.add_command(label='Save game', underline=0, command=self.manager.save_game) game.add_command(label='Save game As ...', underline=10, command=self.manager.save_game_as) game.add_separator() game.add_command(label='Set up Board ...', underline=7, command=self.show_setup_board_dialog) game.add_command(label='Flip board', underline=0, command=self.flip_board) game.add_separator() game.add_command(label='Exit', underline=0, command=self._on_close) self.menubar.add_cascade(label='Game', menu=game) def create_options_menu(self): options = Menu(self.menubar, tearoff=0) think = Menu(options, tearoff=0) think.add_radiobutton(label="1 second", underline=None, command=self.set_think_time, variable=self.thinkTime, value=1) think.add_radiobutton(label="2 seconds", underline=None, command=self.set_think_time, variable=self.thinkTime, value=2) think.add_radiobutton(label="5 seconds", underline=None, command=self.set_think_time, variable=self.thinkTime, value=5) think.add_radiobutton(label="10 seconds", underline=None, command=self.set_think_time, variable=self.thinkTime, value=10) think.add_radiobutton(label="30 seconds", underline=None, command=self.set_think_time, variable=self.thinkTime, value=30) think.add_radiobutton(label="1 minute", underline=None, command=self.set_think_time, variable=self.thinkTime, value=60) options.add_cascade(label='CPU think time', underline=0, menu=think) options.add_separator() options.add_command(label='Preferences ...', underline=0, command=self.show_preferences_dialog) self.menubar.add_cascade(label='Options', menu=options) def create_help_menu(self): helpmenu = Menu(self.menubar, tearoff=0) helpmenu.add_command(label='About Raven ...', underline=0, command=self.show_about_box) self.menubar.add_cascade(label='Help', menu=helpmenu) def stop_processes(self): # stop any controller processes from making moves self.manager.model.curr_state.ok_to_move = False self.manager._controller1.stop_process() self.manager._controller2.stop_process() def show_about_box(self): AboutBox(self.root, 'About Raven') def show_setup_board_dialog(self): self.stop_processes() dlg = SetupBoard(self.root, 'Set up board', self.manager) self.manager.set_controllers() self.root.focus_set() self.manager.turn_finished() def show_preferences_dialog(self): font, size = get_preferences_from_file() dlg = PreferencesDialog(self.root, 'Preferences', font, size) if dlg.result: self.manager.view.init_font_sizes(dlg.font, dlg.size) self.manager.view.init_tags() write_preferences_to_file(dlg.font, dlg.size) def set_think_time(self): self.manager._controller1.set_search_time(self.thinkTime.get()) self.manager._controller2.set_search_time(self.thinkTime.get()) def flip_board(self): if self.manager.model.to_move == BLACK: self.manager._controller1.remove_highlights() else: self.manager._controller2.remove_highlights() self.manager.view.flip_board(not self.manager.view.flip_view) if self.manager.model.to_move == BLACK: self.manager._controller1.add_highlights() else: self.manager._controller2.add_highlights() def start(): root = Tk() mainframe = MainFrame(root) mainframe.root.update() mainframe.root.mainloop() if __name__=='__main__': freeze_support() start()
00eadeyemi-clone
mainframe.py
Python
mit
7,911
from globalconst import BLACK, WHITE, MAN, KING from goalevaluator import GoalEvaluator from onekingattack import Goal_OneKingAttack class OneKingAttackOneKingEvaluator(GoalEvaluator): def __init__(self, bias): GoalEvaluator.__init__(self, bias) def calculateDesirability(self, board): plr_color = board.to_move enemy_color = board.enemy # if we don't have one man on each side or the player # doesn't have the opposition, then goal is undesirable. if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or not board.has_opposition(plr_color)): return 0.0 player = board.get_pieces(plr_color)[0] p_idx, p_val = player p_row, p_col = board.row_col_for_index(p_idx) enemy = board.get_pieces(enemy_color)[0] e_idx, e_val = enemy e_row, e_col = board.row_col_for_index(e_idx) # must be two kings against each other and the distance # between them at least three rows away if ((p_val & KING) and (e_val & KING) and (abs(p_row - e_row) > 2 or abs(p_col - e_col) > 2)): return 1.0 return 0.0 def setGoal(self, board): player = board.to_move board.removeAllSubgoals() if player == WHITE: goalset = board.addWhiteSubgoal else: goalset = board.addBlackSubgoal goalset(Goal_OneKingAttack(board)) class OneKingFleeOneKingEvaluator(GoalEvaluator): def __init__(self, bias): GoalEvaluator.__init__(self, bias) def calculateDesirability(self, board): plr_color = board.to_move enemy_color = board.enemy # if we don't have one man on each side or the player # has the opposition (meaning we should attack instead), # then goal is not applicable. if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or board.has_opposition(plr_color)): return 0.0 player = board.get_pieces(plr_color)[0] p_idx, p_val = player enemy = board.get_pieces(enemy_color)[0] e_idx, e_val = enemy # must be two kings against each other; otherwise it's # not applicable. if not ((p_val & KING) and (e_val & KING)): return 0.0 return 1.0 def setGoal(self, board): player = board.to_move board.removeAllSubgoals() if player == WHITE: goalset = board.addWhiteSubgoal else: goalset = board.addBlackSubgoal goalset(Goal_OneKingFlee(board))
00eadeyemi-clone
onek_onek.py
Python
mit
2,653
from Tkinter import * class CenteredWindow: def __init__(self, root): self.root = root self.root.after_idle(self.center_on_screen) self.root.update() def center_on_screen(self): self.root.update_idletasks() sw = self.root.winfo_screenwidth() sh = self.root.winfo_screenheight() w = self.root.winfo_reqwidth() h = self.root.winfo_reqheight() new_geometry = "+%d+%d" % ((sw-w)/2, (sh-h)/2) self.root.geometry(newGeometry=new_geometry)
00eadeyemi-clone
centeredwindow.py
Python
mit
537
import sys from goal import Goal from composite import CompositeGoal class Goal_OneKingFlee(CompositeGoal): def __init__(self, owner): CompositeGoal.__init__(self, owner) def activate(self): self.status = self.ACTIVE self.removeAllSubgoals() # because goals are *pushed* onto the front of the subgoal list they must # be added in reverse order. self.addSubgoal(Goal_MoveTowardNearestDoubleCorner(self.owner)) self.addSubgoal(Goal_SeeSaw(self.owner)) def process(self): self.activateIfInactive() return self.processSubgoals() def terminate(self): self.status = self.INACTIVE class Goal_MoveTowardBestDoubleCorner(Goal): def __init__(self, owner): Goal.__init__(self, owner) self.dc = [8, 13, 27, 32] def activate(self): self.status = self.ACTIVE def process(self): # if status is inactive, activate self.activateIfInactive() # only moves (not captures) are a valid goal if self.owner.captures: self.status = self.FAILED return # identify player king and enemy king plr_color = self.owner.to_move enemy_color = self.owner.enemy player = self.owner.get_pieces(plr_color)[0] p_idx, _ = player p_row, p_col = self.owner.row_col_for_index(p_idx) enemy = self.owner.get_pieces(enemy_color)[0] e_idx, _ = enemy e_row, e_col = self.owner.row_col_for_index(e_idx) # pick DC that isn't blocked by enemy lowest_dist = sys.maxint dc = 0 for i in self.dc: dc_row, dc_col = self.owner.row_col_for_index(i) pdist = abs(dc_row - p_row) + abs(dc_col - p_col) edist = abs(dc_row - e_row) + abs(dc_col - e_col) if pdist < lowest_dist and edist > pdist: lowest_dist = pdist dc = i # if lowest distance is 0, then goal is complete. if lowest_dist == 0: self.status = self.COMPLETED return # select the available move that decreases the distance # between the original player position and the chosen double corner. # If no such move exists, the goal has failed. dc_row, dc_col = self.owner.row_col_for_index(dc) good_move = None for m in self.owner.moves: # try a move and gather the new row & col for the player self.owner.make_move(m, False, False) plr_update = self.owner.get_pieces(plr_color)[0] pu_idx, _ = plr_update pu_row, pu_col = self.owner.row_col_for_index(pu_idx) self.owner.undo_move(m, False, False) new_diff = abs(pu_row - dc_row) + abs(pu_col - dc_col) if new_diff < lowest_dist: good_move = m break if good_move: self.owner.make_move(good_move, True, True) else: self.status = self.FAILED def terminate(self): self.status = self.INACTIVE class Goal_SeeSaw(Goal): def __init__(self, owner): Goal.__init__(self, owner) def activate(self): self.status = self.ACTIVE def process(self): # for now, I'm not even sure I need this goal, but I'm saving it # as a placeholder. self.status = self.COMPLETED def terminate(self): self.status = self.INACTIVE
00eadeyemi-clone
onekingflee.py
Python
mit
3,630
"""Provide some widely useful utilities. Safe for "from utils import *".""" from __future__ import generators import operator, math, random, copy, sys, os.path, bisect #______________________________________________________________________________ # Simple Data Structures: booleans, infinity, Dict, Struct infinity = 1.0e400 def Dict(**entries): """Create a dict out of the argument=value arguments. Ex: Dict(a=1, b=2, c=3) ==> {'a':1, 'b':2, 'c':3}""" return entries class DefaultDict(dict): """Dictionary with a default value for unknown keys. Ex: d = DefaultDict(0); d['x'] += 1; d['x'] ==> 1 d = DefaultDict([]); d['x'] += [1]; d['y'] += [2]; d['x'] ==> [1]""" def __init__(self, default): self.default = default def __getitem__(self, key): if key in self: return self.get(key) return self.setdefault(key, copy.deepcopy(self.default)) class Struct: """Create an instance with argument=value slots. This is for making a lightweight object whose class doesn't matter. Ex: s = Struct(a=1, b=2); s.a ==> 1; s.a = 3; s ==> Struct(a=3, b=2)""" def __init__(self, **entries): self.__dict__.update(entries) def __cmp__(self, other): if isinstance(other, Struct): return cmp(self.__dict__, other.__dict__) else: return cmp(self.__dict__, other) def __repr__(self): args = ['%s=%s' % (k, repr(v)) for (k, v) in vars(self).items()] return 'Struct(%s)' % ', '.join(args) def update(x, **entries): """Update a dict, or an object with slots, according to entries. Ex: update({'a': 1}, a=10, b=20) ==> {'a': 10, 'b': 20} update(Struct(a=1), a=10, b=20) ==> Struct(a=10, b=20)""" if isinstance(x, dict): x.update(entries) else: x.__dict__.update(entries) return x #______________________________________________________________________________ # Functions on Sequences (mostly inspired by Common Lisp) # NOTE: Sequence functions (count_if, find_if, every, some) take function # argument first (like reduce, filter, and map). def sort(seq, compare=cmp): """Sort seq (mutating it) and return it. compare is the 2nd arg to .sort. Ex: sort([3, 1, 2]) ==> [1, 2, 3]; reverse(sort([3, 1, 2])) ==> [3, 2, 1] sort([-3, 1, 2], comparer(abs)) ==> [1, 2, -3]""" if isinstance(seq, str): seq = ''.join(sort(list(seq), compare)) elif compare == cmp: seq.sort() else: seq.sort(compare) return seq def comparer(key=None, cmp=cmp): """Build a compare function suitable for sort. The most common use is to specify key, meaning compare the values of key(x), key(y).""" if key == None: return cmp else: return lambda x,y: cmp(key(x), key(y)) def removeall(item, seq): """Return a copy of seq (or string) with all occurences of item removed. Ex: removeall(3, [1, 2, 3, 3, 2, 1, 3]) ==> [1, 2, 2, 1] removeall(4, [1, 2, 3]) ==> [1, 2, 3]""" if isinstance(seq, str): return seq.replace(item, '') else: return [x for x in seq if x != item] def reverse(seq): """Return the reverse of a string or list or tuple. Mutates the seq. Ex: reverse([1, 2, 3]) ==> [3, 2, 1]; reverse('abc') ==> 'cba'""" if isinstance(seq, str): return ''.join(reverse(list(seq))) elif isinstance(seq, tuple): return tuple(reverse(list(seq))) else: seq.reverse(); return seq def unique(seq): """Remove duplicate elements from seq. Assumes hashable elements. Ex: unique([1, 2, 3, 2, 1]) ==> [1, 2, 3] # order may vary""" return list(set(seq)) def count_if(predicate, seq): """Count the number of elements of seq for which the predicate is true. count_if(callable, [42, None, max, min]) ==> 2""" f = lambda count, x: count + (not not predicate(x)) return reduce(f, seq, 0) def find_if(predicate, seq): """If there is an element of seq that satisfies predicate, return it. Ex: find_if(callable, [3, min, max]) ==> min find_if(callable, [1, 2, 3]) ==> None""" for x in seq: if predicate(x): return x return None def every(predicate, seq): """True if every element of seq satisfies predicate. Ex: every(callable, [min, max]) ==> 1; every(callable, [min, 3]) ==> 0""" for x in seq: if not predicate(x): return False return True def some(predicate, seq): """If some element x of seq satisfies predicate(x), return predicate(x). Ex: some(callable, [min, 3]) ==> 1; some(callable, [2, 3]) ==> 0""" for x in seq: px = predicate(x) if px: return px return False # Added by Brandon def flatten(x): if type(x) != type([]): return [x] if x == []: return x return flatten(x[0]) + flatten(x[1:]) #______________________________________________________________________________ # Functions on sequences of numbers # NOTE: these take the sequence argument first, like min and max, # and like standard math notation: \sigma (i = 1..n) fn(i) # A lot of programing is finding the best value that satisfies some condition; # so there are three versions of argmin/argmax, depending on what you want to # do with ties: return the first one, return them all, or pick at random. def sum(seq, fn=None): """Sum the elements seq[i], or fn(seq[i]) if fn is given. Ex: sum([1, 2, 3]) ==> 6; sum(range(8), lambda x: 2**x) ==> 255""" if fn: seq = map(fn, seq) return reduce(operator.add, seq, 0) def product(seq, fn=None): """Multiply the elements seq[i], or fn(seq[i]) if fn is given. product([1, 2, 3]) ==> 6; product([1, 2, 3], lambda x: x*x) ==> 1*4*9""" if fn: seq = map(fn, seq) return reduce(operator.mul, seq, 1) def argmin(gen, fn): """Return an element with lowest fn(x) score; tie goes to first one. Gen must be a generator. Ex: argmin(['one', 'to', 'three'], len) ==> 'to'""" best = gen.next(); best_score = fn(best) for x in gen: x_score = fn(x) if x_score < best_score: best, best_score = x, x_score return best def argmin_list(gen, fn): """Return a list of elements of gen with the lowest fn(x) scores. Ex: argmin_list(['one', 'to', 'three', 'or'], len) ==> ['to', 'or']""" best_score, best = fn(gen.next()), [] for x in gen: x_score = fn(x) if x_score < best_score: best, best_score = [x], x_score elif x_score == best_score: best.append(x) return best #def argmin_list(seq, fn): # """Return a list of elements of seq[i] with the lowest fn(seq[i]) scores. # Ex: argmin_list(['one', 'to', 'three', 'or'], len) ==> ['to', 'or']""" # best_score, best = fn(seq[0]), [] # for x in seq: # x_score = fn(x) # if x_score < best_score: # best, best_score = [x], x_score # elif x_score == best_score: # best.append(x) # return best def argmin_random_tie(gen, fn): """Return an element with lowest fn(x) score; break ties at random. Thus, for all s,f: argmin_random_tie(s, f) in argmin_list(s, f)""" try: best = gen.next(); best_score = fn(best); n = 0 except StopIteration: return [] for x in gen: x_score = fn(x) if x_score < best_score: best, best_score = x, x_score; n = 1 elif x_score == best_score: n += 1 if random.randrange(n) == 0: best = x return best #def argmin_random_tie(seq, fn): # """Return an element with lowest fn(seq[i]) score; break ties at random. # Thus, for all s,f: argmin_random_tie(s, f) in argmin_list(s, f)""" # best_score = fn(seq[0]); n = 0 # for x in seq: # x_score = fn(x) # if x_score < best_score: # best, best_score = x, x_score; n = 1 # elif x_score == best_score: # n += 1 # if random.randrange(n) == 0: # best = x # return best def argmax(gen, fn): """Return an element with highest fn(x) score; tie goes to first one. Ex: argmax(['one', 'to', 'three'], len) ==> 'three'""" return argmin(gen, lambda x: -fn(x)) def argmax_list(seq, fn): """Return a list of elements of gen with the highest fn(x) scores. Ex: argmax_list(['one', 'three', 'seven'], len) ==> ['three', 'seven']""" return argmin_list(seq, lambda x: -fn(x)) def argmax_random_tie(seq, fn): "Return an element with highest fn(x) score; break ties at random." return argmin_random_tie(seq, lambda x: -fn(x)) #______________________________________________________________________________ # Statistical and mathematical functions def histogram(values, mode=0, bin_function=None): """Return a list of (value, count) pairs, summarizing the input values. Sorted by increasing value, or if mode=1, by decreasing count. If bin_function is given, map it over values first. Ex: vals = [100, 110, 160, 200, 160, 110, 200, 200, 220] histogram(vals) ==> [(100, 1), (110, 2), (160, 2), (200, 3), (220, 1)] histogram(vals, 1) ==> [(200, 3), (160, 2), (110, 2), (100, 1), (220, 1)] histogram(vals, 1, lambda v: round(v, -2)) ==> [(200.0, 6), (100.0, 3)]""" if bin_function: values = map(bin_function, values) bins = {} for val in values: bins[val] = bins.get(val, 0) + 1 if mode: return sort(bins.items(), lambda x,y: cmp(y[1],x[1])) else: return sort(bins.items()) def log2(x): """Base 2 logarithm. Ex: log2(1024) ==> 10.0; log2(1.0) ==> 0.0; log2(0) raises OverflowError""" return math.log10(x) / math.log10(2) def mode(values): """Return the most common value in the list of values. Ex: mode([1, 2, 3, 2]) ==> 2""" return histogram(values, mode=1)[0][0] def median(values): """Return the middle value, when the values are sorted. If there are an odd number of elements, try to average the middle two. If they can't be averaged (e.g. they are strings), choose one at random. Ex: median([10, 100, 11]) ==> 11; median([1, 2, 3, 4]) ==> 2.5""" n = len(values) values = sort(values[:]) if n % 2 == 1: return values[n/2] else: middle2 = values[(n/2)-1:(n/2)+1] try: return mean(middle2) except TypeError: return random.choice(middle2) def mean(values): """Return the arithmetic average of the values.""" return sum(values) / float(len(values)) def stddev(values, meanval=None): """The standard deviation of a set of values. Pass in the mean if you already know it.""" if meanval == None: meanval = mean(values) return math.sqrt(sum([(x - meanval)**2 for x in values])) def dotproduct(X, Y): """Return the sum of the element-wise product of vectors x and y. Ex: dotproduct([1, 2, 3], [1000, 100, 10]) ==> 1230""" return sum([x * y for x, y in zip(X, Y)]) def vector_add(a, b): """Component-wise addition of two vectors. Ex: vector_add((0, 1), (8, 9)) ==> (8, 10)""" return tuple(map(operator.add, a, b)) def probability(p): "Return true with probability p." return p > random.uniform(0.0, 1.0) def num_or_str(x): """The argument is a string; convert to a number if possible, or strip it. Ex: num_or_str('42') ==> 42; num_or_str(' 42x ') ==> '42x' """ try: return int(x) except ValueError: try: return float(x) except ValueError: return str(x).strip() def distance((ax, ay), (bx, by)): "The distance between two (x, y) points." return math.hypot((ax - bx), (ay - by)) def distance2((ax, ay), (bx, by)): "The square of the distance between two (x, y) points." return (ax - bx)**2 + (ay - by)**2 def normalize(numbers, total=1.0): """Multiply each number by a constant such that the sum is 1.0 (or total). Ex: normalize([1,2,1]) ==> [0.25, 0.5, 0.25]""" k = total / sum(numbers) return [k * n for n in numbers] #______________________________________________________________________________ # Misc Functions def printf(format, *args): """Format args with the first argument as format string, and write. Return the last arg, or format itself if there are no args.""" sys.stdout.write(str(format) % args) return if_(args, args[-1], format) def print_(*args): """Print the args and return the last one.""" for arg in args: print arg, print return if_(args, args[-1], None) def memoize(fn, slot=None): """Memoize fn: make it remember the computed value for any argument list. If slot is specified, store result in that slot of first argument. If slot is false, store results in a dictionary. Ex: def fib(n): return (n<=1 and 1) or (fib(n-1) + fib(n-2)); fib(9) ==> 55 # Now we make it faster: fib = memoize(fib); fib(9) ==> 55""" if slot: def memoized_fn(obj, *args): if hasattr(obj, slot): return getattr(obj, slot) else: val = fn(obj, *args) setattr(obj, slot, val) return val else: def memoized_fn(*args): if not memoized_fn.cache.has_key(args): memoized_fn.cache[args] = fn(*args) return memoized_fn.cache[args] memoized_fn.cache = {} return memoized_fn def method(name, *args): """Return a function that invokes the named method with the optional args. Ex: map(method('upper'), ['a', 'b', 'cee']) ==> ['A', 'B', 'CEE'] map(method('count', 't'), ['this', 'is', 'a', 'test']) ==> [1, 0, 0, 2]""" return lambda x: getattr(x, name)(*args) def method2(name, *static_args): """Return a function that invokes the named method with the optional args. Ex: map(method('upper'), ['a', 'b', 'cee']) ==> ['A', 'B', 'CEE'] map(method('count', 't'), ['this', 'is', 'a', 'test']) ==> [1, 0, 0, 2]""" return lambda x, *dyn_args: getattr(x, name)(*(dyn_args + static_args)) def abstract(): """Indicate abstract methods that should be implemented in a subclass. Ex: def m(): abstract() # Similar to Java's 'abstract void m()'""" raise NotImplementedError(caller() + ' must be implemented in subclass') def caller(n=1): """Return the name of the calling function n levels up in the frame stack. Ex: caller(0) ==> 'caller'; def f(): return caller(); f() ==> 'f'""" import inspect return inspect.getouterframes(inspect.currentframe())[n][3] def indexed(seq): """Like [(i, seq[i]) for i in range(len(seq))], but with yield. Ex: for i, c in indexed('abc'): print i, c""" i = 0 for x in seq: yield i, x i += 1 def if_(test, result, alternative): """Like C++ and Java's (test ? result : alternative), except both result and alternative are always evaluated. However, if either evaluates to a function, it is applied to the empty arglist, so you can delay execution by putting it in a lambda. Ex: if_(2 + 2 == 4, 'ok', lambda: expensive_computation()) ==> 'ok' """ if test: if callable(result): return result() return result else: if callable(alternative): return alternative() return alternative def name(object): "Try to find some reasonable name for the object." return (getattr(object, 'name', 0) or getattr(object, '__name__', 0) or getattr(getattr(object, '__class__', 0), '__name__', 0) or str(object)) def isnumber(x): "Is x a number? We say it is if it has a __int__ method." return hasattr(x, '__int__') def issequence(x): "Is x a sequence? We say it is if it has a __getitem__ method." return hasattr(x, '__getitem__') def print_table(table, header=None, sep=' ', numfmt='%g'): """Print a list of lists as a table, so that columns line up nicely. header, if specified, will be printed as the first row. numfmt is the format for all numbers; you might want e.g. '%6.2f'. (If you want different formats in differnt columns, don't use print_table.) sep is the separator between columns.""" justs = [if_(isnumber(x), 'rjust', 'ljust') for x in table[0]] if header: table = [header] + table table = [[if_(isnumber(x), lambda: numfmt % x, x) for x in row] for row in table] maxlen = lambda seq: max(map(len, seq)) sizes = map(maxlen, zip(*[map(str, row) for row in table])) for row in table: for (j, size, x) in zip(justs, sizes, row): print getattr(str(x), j)(size), sep, print def AIMAFile(components, mode='r'): "Open a file based at the AIMA root directory." dir = os.path.dirname(__file__) return open(apply(os.path.join, [dir] + components), mode) def DataFile(name, mode='r'): "Return a file in the AIMA /data directory." return AIMAFile(['data', name], mode) #______________________________________________________________________________ # Queues: Stack, FIFOQueue, PriorityQueue class Queue: """Queue is an abstract class/interface. There are three types: Stack(): A Last In First Out Queue. FIFOQueue(): A First In First Out Queue. PriorityQueue(lt): Queue where items are sorted by lt, (default <). Each type supports the following methods and functions: q.append(item) -- add an item to the queue q.extend(items) -- equivalent to: for item in items: q.append(item) q.pop() -- return the top item from the queue len(q) -- number of items in q (also q.__len()) Note that isinstance(Stack(), Queue) is false, because we implement stacks as lists. If Python ever gets interfaces, Queue will be an interface.""" def __init__(self): abstract() def extend(self, items): for item in items: self.append(item) def Stack(): """Return an empty list, suitable as a Last-In-First-Out Queue. Ex: q = Stack(); q.append(1); q.append(2); q.pop(), q.pop() ==> (2, 1)""" return [] class FIFOQueue(Queue): """A First-In-First-Out Queue. Ex: q = FIFOQueue();q.append(1);q.append(2); q.pop(), q.pop() ==> (1, 2)""" def __init__(self): self.A = []; self.start = 0 def append(self, item): self.A.append(item) def __len__(self): return len(self.A) - self.start def extend(self, items): self.A.extend(items) def pop(self): e = self.A[self.start] self.start += 1 if self.start > 5 and self.start > len(self.A)/2: self.A = self.A[self.start:] self.start = 0 return e class PriorityQueue(Queue): """A queue in which the minimum (or maximum) element (as determined by f and order) is returned first. If order is min, the item with minimum f(x) is returned first; if order is max, then it is the item with maximum f(x).""" def __init__(self, order=min, f=lambda x: x): update(self, A=[], order=order, f=f) def append(self, item): bisect.insort(self.A, (self.f(item), item)) def __len__(self): return len(self.A) def pop(self): if self.order == min: return self.A.pop(0)[1] else: return self.A.pop()[1] #______________________________________________________________________________ ## NOTE: Once we upgrade to Python 2.3, the following class can be replaced by ## from sets import set class set: """This implements the set class from PEP 218, except it does not overload the infix operators. Ex: s = set([1,2,3]); 1 in s ==> True; 4 in s ==> False s.add(4); 4 in s ==> True; len(s) ==> 4 s.discard(999); s.remove(4); 4 in s ==> False s2 = set([3,4,5]); s.union(s2) ==> set([1,2,3,4,5]) s.intersection(s2) ==> set([3]) set([1,2,3]) == set([3,2,1]); repr(s) == '{1, 2, 3}' for e in s: pass""" def __init__(self, elements): self.dict = {} for e in elements: self.dict[e] = 1 def __contains__(self, element): return element in self.dict def add(self, element): self.dict[element] = 1 def remove(self, element): del self.dict[element] def discard(self, element): if element in self.dict: del self.dict[element] def clear(self): self.dict.clear() def union(self, other): return set(self).union_update(other) def intersection(self, other): return set(self).intersection_update(other) def union_update(self, other): for e in other: self.add(e) def intersection_update(self, other): for e in self.dict.keys(): if e not in other: self.remove(e) def __iter__(self): for e in self.dict: yield e def __len__(self): return len(self.dict) def __cmp__(self, other): return (self is other or (isinstance(other, set) and self.dict == other.dict)) def __repr__(self): return "{%s}" % ", ".join([str(e) for e in self.dict.keys()]) #______________________________________________________________________________ # Additional tests _docex = """ def is_even(x): return x % 2 == 0 sort([1, 2, -3]) ==> [-3, 1, 2] sort(range(10), comparer(key=is_even)) ==> [1, 3, 5, 7, 9, 0, 2, 4, 6, 8] sort(range(10), lambda x,y: y-x) ==> [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] removeall(4, []) ==> [] removeall('s', 'This is a test. Was a test.') ==> 'Thi i a tet. Wa a tet.' removeall('s', 'Something') ==> 'Something' removeall('s', '') ==> '' reverse([]) ==> [] reverse('') ==> '' count_if(is_even, [1, 2, 3, 4]) ==> 2 count_if(is_even, []) ==> 0 sum([]) ==> 0 product([]) ==> 1 argmax([1], lambda x: x*x) ==> 1 argmin([1], lambda x: x*x) ==> 1 argmax([]) raises TypeError argmin([]) raises TypeError # Test of memoize with slots in structures countries = [Struct(name='united states'), Struct(name='canada')] # Pretend that 'gnp' was some big hairy operation: def gnp(country): return len(country.name) * 1e10 gnp = memoize(gnp, '_gnp') map(gnp, countries) ==> [13e10, 6e10] countries # note the _gnp slot. # This time we avoid re-doing the calculation map(gnp, countries) ==> [13e10, 6e10] # Test Queues: nums = [1, 8, 2, 7, 5, 6, -99, 99, 4, 3, 0] def qtest(q): return [q.extend(nums), [q.pop() for i in range(len(q))]][1] qtest(Stack()) ==> reverse(nums) qtest(FIFOQueue()) ==> nums qtest(PriorityQueue(min)) ==> [-99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 99] qtest(PriorityQueue(max)) ==> [99, 8, 7, 6, 5, 4, 3, 2, 1, 0, -99] qtest(PriorityQueue(min, abs)) ==> [0, 1, 2, 3, 4, 5, 6, 7, 8, -99, 99] qtest(PriorityQueue(max, abs)) ==> [99, -99, 8, 7, 6, 5, 4, 3, 2, 1, 0] """
00eadeyemi-clone
utils.py
Python
mit
23,353
import games import time from move import Move from globalconst import BLACK, WHITE, KING, MAN, OCCUPIED, BLACK_CHAR, WHITE_CHAR from globalconst import BLACK_KING, WHITE_KING, FREE, OCCUPIED_CHAR, FREE_CHAR from globalconst import COLORS, TYPES, TURN, CRAMP, BRV, KEV, KCV, MEV, MCV from globalconst import INTACTDOUBLECORNER, ENDGAME, OPENING, MIDGAME from globalconst import create_grid_map, KING_IDX, BLACK_IDX, WHITE_IDX import copy class Checkerboard(object): # (white) # 45 46 47 48 # 39 40 41 42 # 34 35 36 37 # 28 29 30 31 # 23 24 25 26 # 17 18 19 20 # 12 13 14 15 # 6 7 8 9 # (black) valid_squares = [6,7,8,9,12,13,14,15,17,18,19,20,23,24,25,26, 28,29,30,31,34,35,36,37,39,40,41,42,45,46, 47,48] # values of pieces (KING, MAN, BLACK, WHITE, FREE) value = [0,0,0,0,0,1,256,0,0,16,4096,0,0,0,0,0,0] edge = [6,7,8,9,15,17,26,28,37,39,45,46,47,48] center = [18,19,24,25,29,30,35,36] # values used to calculate tempo -- one for each square on board (0, 48) row = [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,2,2,2,2,0,0,3,3,3,3,0, 4,4,4,4,0,0,5,5,5,5,0,6,6,6,6,0,0,7,7,7,7] safeedge = [9,15,39,45] rank = {0:0, 1:-1, 2:1, 3:0, 4:1, 5:1, 6:2, 7:1, 8:1, 9:0, 10:7, 11:4, 12:2, 13:2, 14:9, 15:8} def __init__(self): self.squares = [OCCUPIED for i in range(56)] s = self.squares for i in range(0, 4): s[6+i] = s[12+i] = s[17+i] = BLACK | MAN s[34+i] = s[39+i] = s[45+i] = WHITE | MAN s[23+i] = s[28+i] = FREE self.to_move = BLACK self.charlookup = {BLACK | MAN: BLACK_CHAR, WHITE | MAN: WHITE_CHAR, BLACK | KING: BLACK_KING, WHITE | KING: WHITE_KING, OCCUPIED: OCCUPIED_CHAR, FREE: FREE_CHAR} self.observers = [] self.white_pieces = [] self.black_pieces = [] self.undo_list = [] self.redo_list = [] self.white_total = 12 self.black_total = 12 self.gridmap = create_grid_map() self.ok_to_move = True def __repr__(self): bc = self.count(BLACK) wc = self.count(WHITE) sq = self.squares lookup = self.lookup s = "[%s=%2d %s=%2d (%+d)]\n" % (BLACK_CHAR, bc, WHITE_CHAR, wc, bc - wc) s += "8 %s %s %s %s\n" % (lookup(sq[45]), lookup(sq[46]), lookup(sq[47]), lookup(sq[48])) s += "7 %s %s %s %s\n" % (lookup(sq[39]), lookup(sq[40]), lookup(sq[41]), lookup(sq[42])) s += "6 %s %s %s %s\n" % (lookup(sq[34]), lookup(sq[35]), lookup(sq[36]), lookup(sq[37])) s += "5 %s %s %s %s\n" % (lookup(sq[28]), lookup(sq[29]), lookup(sq[30]), lookup(sq[31])) s += "4 %s %s %s %s\n" % (lookup(sq[23]), lookup(sq[24]), lookup(sq[25]), lookup(sq[26])) s += "3 %s %s %s %s\n" % (lookup(sq[17]), lookup(sq[18]), lookup(sq[19]), lookup(sq[20])) s += "2 %s %s %s %s\n" % (lookup(sq[12]), lookup(sq[13]), lookup(sq[14]), lookup(sq[15])) s += "1 %s %s %s %s\n" % (lookup(sq[6]), lookup(sq[7]), lookup(sq[8]), lookup(sq[9])) s += " a b c d e f g h" return s def _get_enemy(self): if self.to_move == BLACK: return WHITE return BLACK enemy = property(_get_enemy, doc="The color for the player that doesn't have the current turn") def attach(self, observer): if observer not in self.observers: self.observers.append(observer) def detach(self, observer): if observer in self.observers: self.observers.remove(observer) def clear(self): s = self.squares for i in range(0, 4): s[6+i] = s[12+i] = s[17+i] = FREE s[23+i] = s[28+i] = FREE s[34+i] = s[39+i] = s[45+i] = FREE def lookup(self, square): return self.charlookup[square & TYPES] def count(self, color): return self.white_total if color == WHITE else self.black_total def get_pieces(self, color): return self.black_pieces if color == BLACK else self.white_pieces def has_opposition(self, color): sq = self.squares cols = range(6,10) if self.to_move == BLACK else range(12,16) pieces_in_system = 0 for i in cols: for j in range(4): if sq[i+11*j] != FREE: pieces_in_system += 1 return pieces_in_system % 2 == 1 def row_col_for_index(self, idx): return self.gridmap[idx] def update_piece_count(self): self.white_pieces = [] for i, piece in enumerate(self.squares): if piece & COLORS == WHITE: self.white_pieces.append((i, piece)) self.black_pieces = [] for i, piece in enumerate(self.squares): if piece & COLORS == BLACK: self.black_pieces.append((i, piece)) self.white_total = len(self.white_pieces) self.black_total = len(self.black_pieces) def delete_redo_list(self): del self.redo_list[:] def make_move(self, move, notify=True, undo=True, annotation=''): sq = self.squares for idx, _, newval in move.affected_squares: sq[idx] = newval self.to_move ^= COLORS if notify: self.update_piece_count() for o in self.observers: o.notify(move) if undo: move.annotation = annotation self.undo_list.append(move) return self def undo_move(self, move=None, notify=True, redo=True, annotation=''): if move is None: if not self.undo_list: return if redo: move = self.undo_list.pop() rev_move = Move([[idx, dest, src] for idx, src, dest in move.affected_squares]) rev_move.annotation = move.annotation self.make_move(rev_move, notify, False) if redo: move.annotation = annotation self.redo_list.append(move) def undo_all_moves(self, annotation=''): while self.undo_list: move = self.undo_list.pop() rev_move = Move([[idx, dest, src] for idx, src, dest in move.affected_squares]) rev_move.annotation = move.annotation self.make_move(rev_move, True, False) move.annotation = annotation self.redo_list.append(move) annotation = rev_move.annotation def redo_move(self, move=None, annotation=''): if move is None: if not self.redo_list: return move = self.redo_list.pop() self.make_move(move, True, True, annotation) def redo_all_moves(self, annotation=''): while self.redo_list: move = self.redo_list.pop() next_annotation = move.annotation self.make_move(move, True, True, annotation) annotation = next_annotation def reset_undo(self): self.undo_list = [] self.redo_list = [] def utility(self, player): """ Player evaluation function """ sq = self.squares code = sum(self.value[s] for s in sq) nwm = code % 16 nwk = (code >> 4) % 16 nbm = (code >> 8) % 16 nbk = (code >> 12) % 16 v1 = 100 * nbm + 130 * nbk v2 = 100 * nwm + 130 * nwk eval = v1 - v2 # material values # favor exchanges if in material plus eval += (250 * (v1 - v2))/(v1 + v2) nm = nbm + nwm nk = nbk + nwk # fine evaluation below if player == BLACK: eval += TURN mult = -1 else: eval -= TURN mult = 1 return mult * \ (eval + self._eval_cramp(sq) + self._eval_backrankguard(sq) + self._eval_doublecorner(sq) + self._eval_center(sq) + self._eval_edge(sq) + self._eval_tempo(sq, nm, nbk, nbm, nwk, nwm) + self._eval_playeropposition(sq, nwm, nwk, nbk, nbm, nm, nk)) def _extend_capture(self, valid_moves, captures, add_sq_func, visited): player = self.to_move enemy = self.enemy squares = self.squares final_captures = [] while captures: c = captures.pop() new_captures = [] for j in valid_moves: capture = c.affected_squares[:] last_pos = capture[-1][0] mid = last_pos+j dest = last_pos+j*2 if ((last_pos, mid, dest) not in visited and (dest, mid, last_pos) not in visited and squares[mid] & enemy and squares[dest] & FREE): sq2, sq3 = add_sq_func(player, squares, mid, dest, last_pos) capture[-1][2] = FREE capture.extend([sq2, sq3]) visited.add((last_pos, mid, dest)) new_captures.append(Move(capture)) if new_captures: captures.extend(new_captures) else: final_captures.append(Move(capture)) return final_captures def _capture_man(self, player, squares, mid, dest, last_pos): sq2 = [mid, squares[mid], FREE] if ((player == BLACK and last_pos>=34) or (player == WHITE and last_pos<=20)): sq3 = [dest, FREE, player | KING] else: sq3 = [dest, FREE, player | MAN] return sq2, sq3 def _capture_king(self, player, squares, mid, dest, last_pos): sq2 = [mid, squares[mid], FREE] sq3 = [dest, squares[dest], player | KING] return sq2, sq3 def _get_captures(self): player = self.to_move enemy = self.enemy squares = self.squares valid_indices = WHITE_IDX if player == WHITE else BLACK_IDX all_captures = [] for i in self.valid_squares: if squares[i] & player and squares[i] & MAN: for j in valid_indices: mid = i+j dest = i+j*2 if squares[mid] & enemy and squares[dest] & FREE: sq1 = [i, player | MAN, FREE] sq2 = [mid, squares[mid], FREE] if ((player == BLACK and i>=34) or (player == WHITE and i<=20)): sq3 = [dest, FREE, player | KING] else: sq3 = [dest, FREE, player | MAN] capture = [Move([sq1, sq2, sq3])] visited = set() visited.add((i, mid, dest)) temp = squares[i] squares[i] = FREE captures = self._extend_capture(valid_indices, capture, self._capture_man, visited) squares[i] = temp all_captures.extend(captures) if squares[i] & player and squares[i] & KING: for j in KING_IDX: mid = i+j dest = i+j*2 if squares[mid] & enemy and squares[dest] & FREE: sq1 = [i, player | KING, FREE] sq2 = [mid, squares[mid], FREE] sq3 = [dest, squares[dest], player | KING] capture = [Move([sq1, sq2, sq3])] visited = set() visited.add((i, mid, dest)) temp = squares[i] squares[i] = FREE captures = self._extend_capture(KING_IDX, capture, self._capture_king, visited) squares[i] = temp all_captures.extend(captures) return all_captures captures = property(_get_captures, doc="Forced captures for the current player") def _get_moves(self): player = self.to_move squares = self.squares valid_indices = WHITE_IDX if player == WHITE else BLACK_IDX moves = [] for i in self.valid_squares: for j in valid_indices: dest = i+j if (squares[i] & player and squares[i] & MAN and squares[dest] & FREE): sq1 = [i, player | MAN, FREE] if ((player == BLACK and i>=39) or (player == WHITE and i<=15)): sq2 = [dest, FREE, player | KING] else: sq2 = [dest, FREE, player | MAN] moves.append(Move([sq1, sq2])) for j in KING_IDX: dest = i+j if (squares[i] & player and squares[i] & KING and squares[dest] & FREE): sq1 = [i, player | KING, FREE] sq2 = [dest, FREE, player | KING] moves.append(Move([sq1, sq2])) return moves moves = property(_get_moves, doc="Available moves for the current player") def _eval_cramp(self, sq): eval = 0 if sq[28] == BLACK | MAN and sq[34] == WHITE | MAN: eval += CRAMP if sq[26] == WHITE | MAN and sq[20] == BLACK | MAN: eval -= CRAMP return eval def _eval_backrankguard(self, sq): eval = 0 code = 0 if sq[6] & MAN: code += 1 if sq[7] & MAN: code += 2 if sq[8] & MAN: code += 4 if sq[9] & MAN: code += 8 backrank = self.rank[code] code = 0 if sq[45] & MAN: code += 8 if sq[46] & MAN: code += 4 if sq[47] & MAN: code += 2 if sq[48] & MAN: code += 1 backrank = backrank - self.rank[code] eval *= BRV * backrank return eval def _eval_doublecorner(self, sq): eval = 0 if sq[9] == BLACK | MAN: if sq[14] == BLACK | MAN or sq[15] == BLACK | MAN: eval += INTACTDOUBLECORNER if sq[45] == WHITE | MAN: if sq[39] == WHITE | MAN or sq[40] == WHITE | MAN: eval -= INTACTDOUBLECORNER return eval def _eval_center(self, sq): eval = 0 nbmc = nbkc = nwmc = nwkc = 0 for c in self.center: if sq[c] != FREE: if sq[c] == BLACK | MAN: nbmc += 1 if sq[c] == BLACK | KING: nbkc += 1 if sq[c] == WHITE | MAN: nwmc += 1 if sq[c] == WHITE | KING: nwkc += 1 eval += (nbmc-nwmc) * MCV eval += (nbkc-nwkc) * KCV return eval def _eval_edge(self, sq): eval = 0 nbme = nbke = nwme = nwke = 0 for e in self.edge: if sq[e] != FREE: if sq[e] == BLACK | MAN: nbme += 1 if sq[e] == BLACK | KING: nbke += 1 if sq[e] == WHITE | MAN: nwme += 1 if sq[e] == WHITE | KING: nwke += 1 eval -= (nbme-nwme) * MEV eval -= (nbke-nwke) * KEV return eval def _eval_tempo(self, sq, nm, nbk, nbm, nwk, nwm): eval = tempo = 0 for i in range(6, 49): if sq[i] == BLACK | MAN: tempo += self.row[i] if sq[i] == WHITE | MAN: tempo -= 7 - self.row[i] if nm >= 16: eval += OPENING * tempo if nm <= 15 and nm >= 12: eval += MIDGAME * tempo if nm < 9: eval += ENDGAME * tempo for s in self.safeedge: if nbk + nbm > nwk + nwm and nwk < 3: if sq[s] == WHITE | KING: eval -= 15 if nwk + nwm > nbk + nbm and nbk < 3: if sq[s] == BLACK | KING: eval += 15 return eval def _eval_playeropposition(self, sq, nwm, nwk, nbk, nbm, nm, nk): eval = 0 pieces_in_system = 0 tn = nm + nk if nwm + nwk - nbk - nbm == 0: if self.to_move == BLACK: for i in range(6, 10): for j in range(4): if sq[i+11*j] != FREE: pieces_in_system += 1 if pieces_in_system % 2: if tn <= 12: eval += 1 if tn <= 10: eval += 1 if tn <= 8: eval += 2 if tn <= 6: eval += 2 else: if tn <= 12: eval -= 1 if tn <= 10: eval -= 1 if tn <= 8: eval -= 2 if tn <= 6: eval -= 2 else: for i in range(12, 16): for j in range(4): if sq[i+11*j] != FREE: pieces_in_system += 1 if pieces_in_system % 2 == 0: if tn <= 12: eval += 1 if tn <= 10: eval += 1 if tn <= 8: eval += 2 if tn <= 6: eval += 2 else: if tn <= 12: eval -= 1 if tn <= 10: eval -= 1 if tn <= 8: eval -= 2 if tn <= 6: eval -= 2 return eval class Checkers(games.Game): def __init__(self): self.curr_state = Checkerboard() def captures_available(self, curr_state=None): state = curr_state or self.curr_state return state.captures def legal_moves(self, curr_state=None): state = curr_state or self.curr_state return state.captures or state.moves def make_move(self, move, curr_state=None, notify=True, undo=True, annotation=''): state = curr_state or self.curr_state return state.make_move(move, notify, undo, annotation) def undo_move(self, move=None, curr_state=None, notify=True, redo=True, annotation=''): state = curr_state or self.curr_state return state.undo_move(move, notify, redo, annotation) def undo_all_moves(self, curr_state=None, annotation=''): state = curr_state or self.curr_state return state.undo_all_moves(annotation) def redo_move(self, move=None, curr_state=None, annotation=''): state = curr_state or self.curr_state return state.redo_move(move, annotation) def redo_all_moves(self, curr_state=None, annotation=''): state = curr_state or self.curr_state return state.redo_all_moves(annotation) def utility(self, player, curr_state=None): state = curr_state or self.curr_state return state.utility(player) def terminal_test(self, curr_state=None): state = curr_state or self.curr_state return not self.legal_moves(state) def successors(self, curr_state=None): state = curr_state or self.curr_state moves = self.legal_moves(state) if not moves: yield [], state else: undone = False try: try: for move in moves: undone = False self.make_move(move, state, False) yield move, state self.undo_move(move, state, False) undone = True except GeneratorExit: raise finally: if moves and not undone: self.undo_move(move, state, False) def perft(self, depth, curr_state=None): if depth == 0: return 1 state = curr_state or self.curr_state nodes = 0 for move in self.legal_moves(state): state.make_move(move, False, False) nodes += self.perft(depth-1, state) state.undo_move(move, False, False) return nodes def play(): game = Checkers() for depth in range(1, 11): start = time.time() print "Perft for depth %d: %d. Time: %5.3f sec" % (depth, game.perft(depth), time.time() - start) if __name__ == '__main__': play()
00eadeyemi-clone
checkers.py
Python
mit
22,020
from Tkinter import * from Tkconstants import W, E, N, S from tkFileDialog import askopenfilename, asksaveasfilename from tkMessageBox import askyesnocancel, showerror from globalconst import * from checkers import Checkers from boardview import BoardView from playercontroller import PlayerController from alphabetacontroller import AlphaBetaController from gamepersist import SavedGame from textserialize import Serializer class GameManager(object): def __init__(self, **props): self.model = Checkers() self._root = props['root'] self.parent = props['parent'] statusbar = Label(self._root, relief=SUNKEN, font=('Helvetica',7), anchor=NW) statusbar.pack(side='bottom', fill='x') self.view = BoardView(self._root, model=self.model, parent=self, statusbar=statusbar) self.player_color = BLACK self.num_players = 1 self.set_controllers() self._controller1.start_turn() self.filename = None def set_controllers(self): think_time = self.parent.thinkTime.get() if self.num_players == 0: self._controller1 = AlphaBetaController(model=self.model, view=self.view, searchtime=think_time, end_turn_event=self.turn_finished) self._controller2 = AlphaBetaController(model=self.model, view=self.view, searchtime=think_time, end_turn_event=self.turn_finished) elif self.num_players == 1: # assumption here is that Black is the player self._controller1 = PlayerController(model=self.model, view=self.view, end_turn_event=self.turn_finished) self._controller2 = AlphaBetaController(model=self.model, view=self.view, searchtime=think_time, end_turn_event=self.turn_finished) # swap controllers if White is selected as the player if self.player_color == WHITE: self._controller1, self._controller2 = self._controller2, self._controller1 elif self.num_players == 2: self._controller1 = PlayerController(model=self.model, view=self.view, end_turn_event=self.turn_finished) self._controller2 = PlayerController(model=self.model, view=self.view, end_turn_event=self.turn_finished) self._controller1.set_before_turn_event(self._controller2.remove_highlights) self._controller2.set_before_turn_event(self._controller1.remove_highlights) def _stop_updates(self): # stop alphabeta threads from making any moves self.model.curr_state.ok_to_move = False self._controller1.stop_process() self._controller2.stop_process() def _save_curr_game_if_needed(self): if self.view.is_dirty(): msg = 'Do you want to save your changes' if self.filename: msg += ' to %s?' % self.filename else: msg += '?' result = askyesnocancel(TITLE, msg) if result == True: self.save_game() return result else: return False def new_game(self): self._stop_updates() self._save_curr_game_if_needed() self.filename = None self._root.title('Raven ' + VERSION) self.model = Checkers() self.player_color = BLACK self.view.reset_view(self.model) self.think_time = self.parent.thinkTime.get() self.set_controllers() self.view.update_statusbar() self.view.reset_toolbar_buttons() self.view.curr_annotation = '' self._controller1.start_turn() def load_game(self, filename): self._stop_updates() try: saved_game = SavedGame() saved_game.read(filename) self.model.curr_state.clear() self.model.curr_state.to_move = saved_game.to_move self.num_players = saved_game.num_players squares = self.model.curr_state.squares for i in saved_game.black_men: squares[squaremap[i]] = BLACK | MAN for i in saved_game.black_kings: squares[squaremap[i]] = BLACK | KING for i in saved_game.white_men: squares[squaremap[i]] = WHITE | MAN for i in saved_game.white_kings: squares[squaremap[i]] = WHITE | KING self.model.curr_state.reset_undo() self.model.curr_state.redo_list = saved_game.moves self.model.curr_state.update_piece_count() self.view.reset_view(self.model) self.view.serializer.restore(saved_game.description) self.view.curr_annotation = self.view.get_annotation() self.view.flip_board(saved_game.flip_board) self.view.update_statusbar() self.parent.set_title_bar_filename(filename) self.filename = filename except IOError as (err): showerror(PROGRAM_TITLE, 'Invalid file. ' + str(err)) def open_game(self): self._stop_updates() self._save_curr_game_if_needed() f = askopenfilename(filetypes=(('Raven Checkers files','*.rcf'), ('All files','*.*')), initialdir=TRAINING_DIR) if not f: return self.load_game(f) def save_game_as(self): self._stop_updates() filename = asksaveasfilename(filetypes=(('Raven Checkers files','*.rcf'), ('All files','*.*')), initialdir=TRAINING_DIR, defaultextension='.rcf') if filename == '': return self._write_file(filename) def save_game(self): self._stop_updates() filename = self.filename if not self.filename: filename = asksaveasfilename(filetypes=(('Raven Checkers files','*.rcf'), ('All files','*.*')), initialdir=TRAINING_DIR, defaultextension='.rcf') if filename == '': return self._write_file(filename) def _write_file(self, filename): try: saved_game = SavedGame() # undo moves back to the beginning of play undo_steps = 0 while self.model.curr_state.undo_list: undo_steps += 1 self.model.curr_state.undo_move(None, True, True, self.view.get_annotation()) # save the state of the board saved_game.to_move = self.model.curr_state.to_move saved_game.num_players = self.num_players saved_game.black_men = [] saved_game.black_kings = [] saved_game.white_men = [] saved_game.white_kings = [] for i, sq in enumerate(self.model.curr_state.squares): if sq == BLACK | MAN: saved_game.black_men.append(keymap[i]) elif sq == BLACK | KING: saved_game.black_kings.append(keymap[i]) elif sq == WHITE | MAN: saved_game.white_men.append(keymap[i]) elif sq == WHITE | KING: saved_game.white_kings.append(keymap[i]) saved_game.description = self.view.serializer.dump() saved_game.moves = self.model.curr_state.redo_list saved_game.flip_board = self.view.flip_view saved_game.write(filename) # redo moves forward to the previous state for i in range(undo_steps): annotation = self.view.get_annotation() self.model.curr_state.redo_move(None, annotation) # record current filename in title bar self.parent.set_title_bar_filename(filename) self.filename = filename except IOError: showerror(PROGRAM_TITLE, 'Could not save file.') def turn_finished(self): if self.model.curr_state.to_move == BLACK: self._controller2.end_turn() # end White's turn self._root.update() self.view.update_statusbar() self._controller1.start_turn() # begin Black's turn else: self._controller1.end_turn() # end Black's turn self._root.update() self.view.update_statusbar() self._controller2.start_turn() # begin White's turn
00eadeyemi-clone
gamemanager.py
Python
mit
9,550
class Move(object): def __init__(self, squares, annotation=''): self.affected_squares = squares self.annotation = annotation def __repr__(self): return str(self.affected_squares)
00eadeyemi-clone
move.py
Python
mit
219