annotate Lib/IMPL/Object/EventSource.pm @ 96:4c55aed00ff2

Minor changes
author wizard
date Fri, 30 Apr 2010 15:03:38 +0400
parents 16ada169ca75
children 4267a2ac3d46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
1 package IMPL::Object::EventSource;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
3 require IMPL::Exception;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
4 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
5
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
6 sub CreateEvent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
7 my ($class,$event) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
9 die new IMPL::Exception('A name is required for the event') unless $event;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
11 (my $fullEventName = "$class$event") =~ s/:://g;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
13 my $globalEventTable = new IMPL::Object::EventSource::EventTable($fullEventName);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
14 my $propEventTable = $event.'Table';
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
15 public CreateProperty($class,$propEventTable,prop_all);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
16 public CreateProperty($class,$event,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
17 {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
18 get => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
19 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
20 if (not defined wantarray and caller(1) eq $class) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
21 (ref $this ? $this->$propEventTable() || $globalEventTable : $globalEventTable)->Invoke($this);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
22 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
23 if (ref $this) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
24 if (my $table = $this->$propEventTable()) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
25 return $table;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
26 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
27 $table = new IMPL::Object::EventSource::EventTable($fullEventName,$globalEventTable);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
28 $this->$propEventTable($table);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
29 return $table;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
30 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
31 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
32 return $globalEventTable;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
33 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
34 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
35 },
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
36 set => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
37 (ref $_[0] ? $_[0]->$propEventTable() || $globalEventTable : $globalEventTable)->Invoke(@_);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
38 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
39 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
40 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
41 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
43 sub CreateStaticEvent {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
44 my ($class,$event) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
45
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
46 die new IMPL::Exception('A name is required for the event') unless $event;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
47
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
48 (my $fullEventName = "$class$event") =~ s/:://g;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
50 my $globalEventTable = new IMPL::Object::EventSource::EventTable($fullEventName);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
51
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
52 no strict 'refs';
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
53 *{"${class}::$event"} = sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
54 shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
55 if (not @_) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
56 if (not defined wantarray and caller(1) eq $class) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
57 $globalEventTable->Invoke($class);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
58 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
59 return $globalEventTable;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
60 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
61 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
62 $globalEventTable->Invoke($class,@_);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
63 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
64 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
65 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
67 package IMPL::Object::EventSource::EventTable;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
68 use base qw(IMPL::Object);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
69 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
70 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
71 use Scalar::Util qw(weaken);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
72
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
73 use overload
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
74 '+=' => \&opSubscribe,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
75 'fallback' => 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
76
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
77 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
78 public _direct property Name => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
79 public _direct property Handlers => { get => \&get_handlers };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
80 private _direct property Next => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
81 private _direct property NextId => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
82 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
83
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
84 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
85 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
86
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
87 $this->{$Handlers} = {};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
88 $this->{$Name} = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
89 $this->{$Next} = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
90 $this->{$NextId} = 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
91 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
92
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
93 sub get_handlers {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
94 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
95 return values %{$this->{$Handlers}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
96 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
97
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
98 sub Invoke {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
99 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
100
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
101 my $tmp;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
102 $tmp = $_ and local($_) or &$tmp(@_) foreach values %{$this->{$Handlers}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
103
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
104 $this->{$Next}->Invoke(@_) if $this->{$Next};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
105 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
106
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
107 sub Subscribe {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
108 my ($this,$consumer,$nameHandler) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
109
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
110 my $id = $this->{$NextId} ++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
111
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
112 if (ref $consumer eq 'CODE') {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
113 $this->{$Handlers}{$id} = $consumer;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
114 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
115 $nameHandler ||= $this->Name or die new IMPL::Exception('The name for the event handler method must be specified');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
116 my $method = $consumer->can($nameHandler) or die new IMPL::Exception('Can\'t find the event handler method',$nameHandler,$consumer);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
117
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
118 weaken($consumer) if ref $consumer;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
119 $this->{$Handlers}{$id} = sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
120 unshift @_, $consumer;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
121 $consumer ? goto &$method : delete $this->{$Handlers}{$id};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
122 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
123 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
124
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
125 return $id;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
126 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
127
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
128 sub Remove {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
129 my ($this,$id) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
130 return delete $this->{$Handlers}{$id};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
131 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
132 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
133
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
134 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
135 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
136 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
137 package Foo;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
138 use base qw(IMPL::Object IMPL::Object::EventSource);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
139
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
140 # declare events
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
141 __PACKAGE__->CreateEvent('OnUpdate');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
142 __PACKAGE__->CreateStaticEvent('OnNewObject');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
143
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
144 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
145 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
146 // rise static event
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
147 $this->OnNewObject();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
148 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
149
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
150 sub Update {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
151 my ($this,$val) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
152
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
153 // rise object event
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
154 $this->OnUpdate($val);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
155 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
156
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
157 package Bar;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
158
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
159 // subscribe static event
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
160 Foo->OnNewObject->Subscribe(sub { warn "New $_[0] created" } );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
161
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
162 sub LookForFoo {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
163 my ($this,$foo) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
164
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
165 // subscribe object event
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
166 $foo->OnUpdate->Subscribe($this,'OnFooUpdate');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
167 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
168
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
169 // event handler
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
170 sub OnFooUpdate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
171 my ($this,$sender,$value) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
172 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
173
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
174 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
175 Позволяет объявлять и инициировать события. События делятся на статические и
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
176 локальные. Статические события объявляются для класса и при возникновении
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
177 данного события вызываются всегда все подписчики. Статические события могут быть
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
178 вызваны как для класса, так и для объекта, что приведет к одинаковым результатам.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
179
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
180 Локальные события состоят из статической (как статические события) и локальной
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
181 части. Если подписываться на события класса, то обработчики будут вызываться при
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
182 любых вариантах инициации данного события (как у статических событий). При
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
183 подписке на события объекта, обработчик будет вызван только при возникновении
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
184 событий у данного объекта.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
185
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
186 =head1 METHODS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
187 =level 4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
188 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
189
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
190 =head1 EventTable
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
191
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
192 =cut