Bootstrapping mechanism for the mxGraph thin client. The production version of this file contains all code required to run the mxGraph thin client, as well as global constants to identify the browser and operating system in use. You may have to load chrome://global/content/contentAreaUtils.js in your page to disable certain security restrictions in Mozilla.
mxClient | Bootstrapping mechanism for the mxGraph thin client. |
Variables | |
VERSION | Contains the current version of the mxGraph library. |
IS_IE | True if the current browser is Internet Explorer. |
IS_IE6 | True if the current browser is Internet Explorer 6.x. |
IS_NS | True if the current browser is Netscape (including Firefox). |
IS_OP | True if the current browser is Opera. |
IS_OT | True if -o-transform is available as a CSS style. |
IS_SF | True if the current browser is Safari. |
IS_GC | True if the current browser is Google Chrome. |
IS_MT | True if -moz-transform is available as a CSS style. |
IS_SVG | True if the browser supports SVG. |
NO_FO | True if foreignObject support is not available. |
IS_VML | True if the browser supports VML. |
IS_MAC | True if the client is a Mac. |
IS_TOUCH | True if this client uses a touch interface (no mouse). |
IS_LOCAL | True if the documents location does not start with http:// or https://. |
Functions | |
isBrowserSupported | Returns true if the current browser is supported, that is, if mxClient.IS_VML or mxClient.IS_SVG is true. |
link | Adds a link node to the head of the document. |
include | Dynamically adds a script node to the document header. |
dispose | Frees up memory in IE by resolving cyclic dependencies between the DOM and the JavaScript objects. |
Variables | |
mxLoadResources | Optional global config variable to toggle loading of the two resource files in mxGraph and mxEditor. |
mxLoadStylesheets | Optional global config variable to toggle loading of the CSS files when the library is initialized. |
basePath | Basepath for all URLs in the core without trailing slash. |
imageBasePath | Basepath for all images URLs in the core without trailing slash. |
language | Defines the language of the client, eg. |
defaultLanguage | Defines the default language which is used in the common resource files. |
languages | Defines the optional array of all supported language extensions. |
isBrowserSupported: function()
Returns true if the current browser is supported, that is, if mxClient.IS_VML or mxClient.IS_SVG is true.
if (!mxClient.isBrowserSupported()) { mxUtils.error('Browser is not supported!', 200, false); }
link: function( rel, href, doc )
Adds a link node to the head of the document. Use this to add a stylesheet to the page as follows:
mxClient.link('stylesheet', filename);
where filename is the (relative) URL of the stylesheet. The charset is hardcoded to ISO-8859-1 and the type is text/css.
rel | String that represents the rel attribute of the link node. |
href | String that represents the href attribute of the link node. |
doc | Optional parent document of the link node. |
include: function( src )
Dynamically adds a script node to the document header.
In production environments, the includes are resolved in the mxClient.js file to reduce the number of requests required for client startup. This function should only be used in development environments, but not in production systems.
Optional global config variable to toggle loading of the two resource files in mxGraph and mxEditor. Default is true. NOTE: This is a global variable, not a variable of mxClient.
<script type="text/javascript"> mxLoadResources = false; </script> <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
Optional global config variable to toggle loading of the CSS files when the library is initialized. Default is true. NOTE: This is a global variable, not a variable of mxClient.
<script type="text/javascript"> mxLoadStylesheets = false; </script> <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
Basepath for all URLs in the core without trailing slash. Default is ‘.’. Set mxBasePath prior to loading the mxClient library as follows to override this setting:
<script type="text/javascript"> mxBasePath = '/path/to/core/directory'; </script> <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
When using a relative path, the path is relative to the URL of the page that contains the assignment. Trailing slashes are automatically removed.
Basepath for all images URLs in the core without trailing slash. Default is mxClient.basePath + ‘/images’. Set mxImageBasePath prior to loading the mxClient library as follows to override this setting:
<script type="text/javascript"> mxImageBasePath = '/path/to/image/directory'; </script> <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
When using a relative path, the path is relative to the URL of the page that contains the assignment. Trailing slashes are automatically removed.
Defines the language of the client, eg. en for english, de for german etc. The special value ‘none’ will disable all built-in internationalization and resource loading. See mxResources.getSpecialBundle for handling identifiers with and without a dash.
Set mxLanguage prior to loading the mxClient library as follows to override this setting:
<script type="text/javascript"> mxLanguage = 'en'; </script> <script type="text/javascript" src="js/mxClient.js"></script>
If internationalization is disabled, then the following variables should be overridden to reflect the current language of the system. These variables are cleared when i18n is disabled. mxEditor.askZoomResource, mxEditor.lastSavedResource, mxEditor.currentFileResource, mxEditor.propertiesResource, mxEditor.tasksResource, mxEditor.helpResource, mxEditor.outlineResource, mxElbowEdgeHandler.doubleClickOrientationResource, mxUtils.errorResource, mxUtils.closeResource, mxGraphSelectionModel.doneResource, mxGraphSelectionModel.updatingSelectionResource, mxGraphView.doneResource, mxGraphView.updatingDocumentResource, <mxCellRenderer.collapseExpandResource>, mxGraph.containsValidationErrorsResource and mxGraph.alreadyConnectedResource.
Defines the default language which is used in the common resource files. Any resources for this language will only load the common resource file, but not the language-specific resource file. Default is ‘en’.
Set mxDefaultLanguage prior to loading the mxClient library as follows to override this setting:
<script type="text/javascript"> mxDefaultLanguage = 'de'; </script> <script type="text/javascript" src="js/mxClient.js"></script>
Defines the optional array of all supported language extensions. The default language does not have to be part of this list. See <mxResources.isLanguageSupported>.
<script type="text/javascript"> mxLanguages = ['de', 'it', 'fr']; </script> <script type="text/javascript" src="js/mxClient.js"></script>
This is used to avoid unnecessary requests to language files, ie. if a 404 will be returned.
True if the current browser is Internet Explorer.
IS_IE: navigator.userAgent.indexOf( 'MSIE' ) >
True if the current browser is Internet Explorer 6.x.
IS_IE6: navigator.userAgent.indexOf( 'MSIE 6' ) >
True if the current browser is Netscape (including Firefox).
IS_NS: navigator.userAgent.indexOf( 'Mozilla/' ) >
True if the current browser is Opera.
IS_OP: navigator.userAgent.indexOf( 'Opera/' ) >
True if the current browser is Safari.
IS_SF: navigator.userAgent.indexOf( 'AppleWebKit/' ) >
True if the current browser is Google Chrome.
IS_GC: navigator.userAgent.indexOf( 'Chrome/' ) >
True if the browser supports SVG.
IS_SVG: navigator.userAgent.indexOf( 'Firefox/' ) >
True if foreignObject support is not available.
NO_FO: navigator.userAgent.indexOf( 'Firefox/1.' ) >
True if the browser supports VML.
IS_VML: navigator.appName.toUpperCase()
Returns true if the current browser is supported, that is, if mxClient.IS_VML or mxClient.IS_SVG is true.
isBrowserSupported: function()
Adds a link node to the head of the document.
link: function( rel, href, doc )
Dynamically adds a script node to the document header.
include: function( src )
Frees up memory in IE by resolving cyclic dependencies between the DOM and the JavaScript objects.
dispose: function()
Hook for subclassers to return the URL for the special bundle.
getSpecialBundle: function( basename, lan )
Specifies the resource key for the zoom dialog.
mxEditor.prototype.askZoomResource
Specifies the resource key for the last saved info.
mxEditor.prototype.lastSavedResource
Specifies the resource key for the current file info.
mxEditor.prototype.currentFileResource
Specifies the resource key for the properties window title.
mxEditor.prototype.propertiesResource
Specifies the resource key for the tasks window title.
mxEditor.prototype.tasksResource
Specifies the resource key for the help window title.
mxEditor.prototype.helpResource
Specifies the resource key for the outline window title.
mxEditor.prototype.outlineResource
Specifies the resource key for the tooltip to be displayed on the single control point for routed edges.
mxElbowEdgeHandler.prototype.doubleClickOrientationResource
Specifies the resource key for the status message after a long operation.
mxGraphSelectionModel.prototype.doneResource
Specifies the resource key for the status message while the selection is being updated.
mxGraphSelectionModel.prototype.updatingSelectionResource
Specifies the resource key for the status message after a long operation.
mxGraphView.prototype.doneResource
Specifies the resource key for the warning message to be displayed when a collapsed cell contains validation errors.
mxGraph.prototype.containsValidationErrorsResource
Specifies the resource key for the error message to be displayed in non-multigraphs when two vertices are already connected.
mxGraph.prototype.alreadyConnectedResource