Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
93 lines (83 loc) · 2.06 KB

File metadata and controls

93 lines (83 loc) · 2.06 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* $Id: mxModelCodec.php,v 1.1 2012/11/15 13:26:46 gaudenz Exp $
* Copyright (c) 2006-2010, Gaudenz Alder
*/
class mxModelCodec extends mxObjectCodec
{
/**
* Class: mxModelCodec
*
* Codec for <mxGraphModels>. This class is created and registered
* dynamically at load time and used implicitly via <mxCodec>
* and the <mxCodecRegistry>.
*
* Constructor: mxObjectCodec
*
* Constructs a new codec for the specified template object.
* The variables in the optional exclude array are ignored by
* the codec. Variables in the optional idrefs array are
* turned into references in the XML. The optional mapping
* may be used to map from variable names to XML attributes.
*
* Parameters:
*
* template - Prototypical instance of the object to be
* encoded/decoded.
* exclude - Optional array of fieldnames to be ignored.
* idrefs - Optional array of fieldnames to be converted to/from
* references.
* mapping - Optional mapping from field- to attributenames.
*/
function mxModelCodec($template)
{
parent::mxObjectCodec($template);
}
/**
* Overrides <mxObjectCodec.encodeObject>.
*/
function encodeObject($enc, $obj, $node)
{
$rootNode = $enc->document->createElement("root");
$enc->encodeCell($obj->getRoot(), $rootNode);
$node->appendChild($rootNode);
}
/**
* Override <mxObjectCodec.decodeChild>.
*/
function decodeChild($dec, $child, &$obj)
{
if ($child->nodeName == "root")
{
$this->decodeRoot($dec, $child, $obj);
}
else
{
parent::decodeChild($dec, $child, $obj);
}
}
/**
* Override <mxObjectCodec.decodeRoot>.
*/
function decodeRoot($dec, $root, $model)
{
$rootCell = null;
$tmp = $root->firstChild;
while (isset($tmp))
{
$cell = $dec->decodeCell($tmp);
if (isset($cell) && $cell->getParent() == null)
{
$rootCell = $cell;
}
$tmp = $tmp->nextSibling;
}
// Sets the root on the model if one has been decoded
if (isset($rootCell))
{
$model->setRoot($rootCell);
}
}
}
mxCodecRegistry::register(new mxModelCodec(new mxGraphModel()));
?>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.