forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmxEventObject.php
More file actions
107 lines (96 loc) · 1.67 KB
/
mxEventObject.php
File metadata and controls
107 lines (96 loc) · 1.67 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Copyright (c) 2006-2013, Gaudenz Alder
*/
class mxEventObject
{
/**
* Class: mxEventObject
*
* Base class for all events.
*
* Variable: name
*
* Holds the name of the event.
*/
var $name;
/**
* Variable: properties
*
* Holds the event properties in an associative array that maps from string
* (key) to object (value).
*/
var $properties;
/**
* Variable: consumed
*
* Holds the consumed state of the event. Default is false.
*/
var $consumed = false;
/**
* Constructor: mxEventObject
*
* Constructs a new event for the given name and properties. The optional
* properties are specified using a sequence of keys and values, eg.
* new mxEventObject($name, $key1, $value1, $key2, $value2, .., $keyN, $valueN)
*/
function mxEventObject($name)
{
$this->name = $name;
$this->properties = array();
$args = func_get_args();
for ($i = 1; $i < sizeof($args); $i += 2)
{
if (isset($args[$i + 1]))
{
$this->properties[$args[$i]] = $args[$i + 1];
}
}
}
/**
* Function: getName
*
* Returns <name>.
*/
function getName()
{
return $this->name;
}
/**
* Function: getProperties
*
* Returns <properties>.
*/
function getProperties()
{
return $this->properties;
}
/**
* Function: getProperty
*
* Returns the property value for the given key.
*/
function getProperty($key)
{
return $this->properties[$key];
}
/**
* Function: isConsumed
*
* Returns true if the event has been consumed.
*/
function isConsumed()
{
return $this->consumed;
}
/**
* Function: consume
*
* Consumes the event.
*/
function consume()
{
$this->consumed = true;
}
}
?>