GrxUIonEclipse-project-0.9.8
src
com
generalrobotix
ui
view
tdview
ViewModeChangeMulticaster.java
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3
* All rights reserved. This program is made available under the terms of the
4
* Eclipse Public License v1.0 which accompanies this distribution, and is
5
* available at http://www.eclipse.org/legal/epl-v10.html
6
* Contributors:
7
* General Robotix Inc.
8
* National Institute of Advanced Industrial Science and Technology (AIST)
9
*/
10
package
com.generalrobotix.ui.view.tdview;
11
12
public
class
ViewModeChangeMulticaster
implements
ViewModeChangeListener
{
13
protected
ViewModeChangeListener
listener1_
, listener2_;
14
15
protected
ViewModeChangeMulticaster
(
16
ViewModeChangeListener
listener1,
17
ViewModeChangeListener
listener2
18
) {
19
listener1_ = listener1;
20
listener2_ = listener2;
21
}
22
23
public
void
viewModeChanged
(
int
mode) {
24
listener1_.
viewModeChanged
(mode);
25
listener2_.
viewModeChanged
(mode);
26
}
27
28
public
static
ViewModeChangeListener
add
(
29
ViewModeChangeListener
listener1,
30
ViewModeChangeListener
listener2
31
) {
32
if
(listener1 ==
null
)
return
listener2;
33
if
(listener2 ==
null
)
return
listener1;
34
return
new
ViewModeChangeMulticaster
(listener1, listener2);
35
}
36
37
public
static
ViewModeChangeListener
remove
(
38
ViewModeChangeListener
listener,
39
ViewModeChangeListener
old
40
) {
41
if
(listener == old || listener ==
null
) {
42
return
null
;
43
}
else
if
(listener instanceof
ViewModeChangeMulticaster
) {
44
return
((ViewModeChangeMulticaster)listener).
remove
(old);
45
}
else
{
46
return
listener;
47
}
48
}
49
50
protected
ViewModeChangeListener
remove
(
ViewModeChangeListener
listener) {
51
if
(listener == listener1_)
return
listener2_;
52
if
(listener == listener2_)
return
listener1_
;
53
ViewModeChangeListener
listener1 =
remove
(
listener1_
, listener);
54
ViewModeChangeListener
listener2 =
remove
(listener2_, listener);
55
if
(listener1 == listener1_ && listener2 == listener2_) {
56
return
this
;
57
}
58
return
add
(listener1, listener2);
59
}
60
}
null
#define null
our own NULL pointer
Definition:
IceTypes.h:57
com.generalrobotix.ui.view.tdview.ViewModeChangeMulticaster.add
static ViewModeChangeListener add(ViewModeChangeListener listener1, ViewModeChangeListener listener2)
Definition:
ViewModeChangeMulticaster.java:28
com.generalrobotix.ui.view.tdview.ViewModeChangeMulticaster.listener1_
ViewModeChangeListener listener1_
Definition:
ViewModeChangeMulticaster.java:13
com.generalrobotix.ui.view.tdview.ViewModeChangeListener.viewModeChanged
void viewModeChanged(int mode)
com.generalrobotix.ui.view.tdview.ViewModeChangeMulticaster
Definition:
ViewModeChangeMulticaster.java:12
com.generalrobotix.ui.view.tdview.ViewModeChangeMulticaster.viewModeChanged
void viewModeChanged(int mode)
Definition:
ViewModeChangeMulticaster.java:23
com.generalrobotix.ui.view.tdview.ViewModeChangeMulticaster.ViewModeChangeMulticaster
ViewModeChangeMulticaster(ViewModeChangeListener listener1, ViewModeChangeListener listener2)
Definition:
ViewModeChangeMulticaster.java:15
com.generalrobotix.ui.view.tdview.ViewModeChangeListener
Definition:
ViewModeChangeListener.java:14
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05