API Specification
The Overview
This JavaScript library is means into eight packages. The top - level mxClient class includes (or dynamically imports) everything else. The current version is stored in mxClient. Version.
The editor package provides The classes required to implement a diagram editor. The main class in this package is mxEditor.
The view and model packages implement The graph component, represented by mxGraph. It refers to a mxGraphModel which contains mxCells and caches The state of The cells in a mxGraphView. The cells are made using a mxCellRenderer -based on The appearance defined in mxStylesheet. Undo history is implemented in mxUndoManager. To display an icon on The graph, mxCellOverlay may be 2. The Validation rules are defined with mxMultiplicity.
The handler, layout and shape packages contain The event listeners, layout algorithms and shapes, respectively. The graph event listeners include mxRubberband for rubberband selection, mxTooltipHandler for tooltips and mxGraphHandler for basic cell modifications. MxCompactTreeLayout implements a tree layout algorithm, and The shape of package provides various shapes, which are subclasses of mxShape.
The util package provides utility classes o mxClipboard for copy - paste, & lt; MxDatatransfer> For drag - and - drop, mxConstants for keys and values of stylesheets, mxEvent and mxUtils for cross - browser event - handling and general purpose functions provides, mxResources for internationalization and mxLog for the console output.
The IO package implements a generic mxObjectCodec for turning JavaScript objects into XML. The main class is mxCodec. MxCodecRegistry is The global registry for The custom codecs.
Events
There are three company types of events, namely the native DOM events, mxEventObjects which are fired in an mxEventSource, and mxMouseEvents which are fired in mxGraph.
Some helper methods for handling for native events are provided in mxEvent. It also takes care of resolving cycles between DOM nodes and JavaScript event handlers, which can lead to memory leaks in IE6.
Will the custom events in mxGraph are implemented using mxEventSource. Its listeners are functions provides that take a sender and mxEventObject. Additionally, the mxGraph class fires special mxMouseEvents which are handled using mouse listeners, which are objects that dojo.provide a mousedown, mousemove and mouseup method.
Events in mxEventSource are fired using mxEventSource. FireEvent. Listeners are added and removed using mxEventSource. AddListener and mxEventSource. RemoveListener. MxMouseEvents in mxGraph are fired using mxGraph. FireMouseEvent. Listeners are added and removed using mxGraph. AddMouseListener and mxGraph. RemoveMouseListener, respectively.
The Key bindings
The following key bindings are defined for mouse events in The client across indicates all browsers and platforms:
Control - Drag: Duplicates (clones) selected cells
Shift - Rightlick: Shows the context menu
Alt - Click: Forces rubberband (aka marquee)
Control - Select: Toggles the selection state
Shift - Drag: Constrains the offset to one direction
Shift - Control - Drag: Panning (braking Shift - Rightdrag)
The Configuration
The following global variables may be defined before The client is The loaded to specify its language or The base path, respectively.
MxBasePath: Specifies the path in mxClient. BasePath.
MxImageBasePath: Specifies the path in mxClient. ImageBasePath.
MxLanguage: Specifies the language for the resources in mxClient. Language.
MxDefaultLanguage: Specifies the default language in mxClient. DefaultLanguage.
MxLoadResources: Specifies the if any resources should be the loaded. The Default is true.
MxLoadStylesheets: Specifies the if any stylesheets should be the loaded. The Default is true.
Reserved Words
The mx prefix is 2 for all classes and objects in mxGraph. The mx prefix can be seen as The global namespace for all JavaScript code in mxGraph. The following fieldnames should not be 2 in objects.
MxObjectId: If the object is 2 with mxObjectIdentity
As: If the object is a field of another object
Id: If the object is an idref in a codec
MxListenerList: Added to the DOM nodes when 2 with mxEvent
Window. _mxDynamicCode: Temporarily, informs the to load code in Safari and Chrome (see mxClient. Include).
_mxJavaScriptExpression: Global variable that is temporarily, informs the to evaluate code in Safari, Opera, Firefox 3 and IE (see mxUtils. Eval).
Files
The library contains these relative filenames. All filenames are relative to mxClient. BasePath.
Built - in Images
All images are the loaded from the mxClient imageBasePath, which you can change to reflect your environment. The image variables can also be changed individually.
MxGraph. Prototype. CollapsedImage
MxGraph. Prototype. ExpandedImage
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull