gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / observer / BaseNotification.java @ 3010
History | View | Annotate | Download (1.46 KB)
1 |
package org.gvsig.tools.observer; |
---|---|
2 |
|
3 |
public class BaseNotification implements Notification { |
4 |
|
5 |
private final String type; |
6 |
protected Object[] values; |
7 |
protected boolean canceled = false; |
8 |
private boolean aborted; |
9 |
|
10 |
public BaseNotification(String type, int values) { |
11 |
this.type = type;
|
12 |
this.values = new Object[values]; |
13 |
} |
14 |
|
15 |
public BaseNotification(String type, Object[] values) { |
16 |
this.type = type;
|
17 |
this.values = values;
|
18 |
} |
19 |
|
20 |
@Override
|
21 |
public String getType() { |
22 |
return this.type; |
23 |
} |
24 |
|
25 |
@Override
|
26 |
public boolean isOfType(String type) { |
27 |
return type.equalsIgnoreCase(this.type); |
28 |
} |
29 |
|
30 |
@Override
|
31 |
public Object getValue() { |
32 |
if( this.values==null ) { |
33 |
return null; |
34 |
} |
35 |
return this.values[0]; |
36 |
} |
37 |
|
38 |
@Override
|
39 |
public Object getValue(int n) { |
40 |
if( this.values==null ) { |
41 |
return null; |
42 |
} |
43 |
return this.values[n]; |
44 |
} |
45 |
|
46 |
@Override
|
47 |
public void setValue(Object value) { |
48 |
this.values[0] = value; |
49 |
} |
50 |
|
51 |
@Override
|
52 |
public void setValue(int n, Object value) { |
53 |
this.values[n] = value;
|
54 |
} |
55 |
|
56 |
@Override
|
57 |
public boolean isCanceled() { |
58 |
return this.canceled; |
59 |
} |
60 |
|
61 |
@Override
|
62 |
public void cancel() { |
63 |
this.canceled = true; |
64 |
} |
65 |
|
66 |
@Override
|
67 |
public boolean isAborted() { |
68 |
return this.aborted; |
69 |
} |
70 |
|
71 |
@Override
|
72 |
public void abort() { |
73 |
this.aborted = true; |
74 |
} |
75 |
} |
76 |
|