Revision 23170
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/observer/Observable.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.observer; |
2 | 28 |
|
3 | 29 |
|
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/observer/Observer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.observer; |
2 | 28 |
|
3 | 29 |
|
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/observer/DefaultObservable.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.observer; |
2 | 28 |
|
3 | 29 |
import java.lang.ref.Reference; |
... | ... | |
39 | 65 |
} |
40 | 66 |
|
41 | 67 |
public synchronized void addObserver(Reference ref) { |
42 |
if (ref == null || ref.get() == null) |
|
43 |
throw new NullPointerException(); |
|
68 |
if (ref == null || ref.get() == null) { |
|
69 |
throw new NullPointerException(); |
|
70 |
} |
|
44 | 71 |
Observer o = (Observer)ref.get(); |
45 | 72 |
if (!contains(o)) { |
46 | 73 |
obs.addElement(ref); |
... | ... | |
109 | 136 |
public synchronized void deleteObserver(Reference ref) { |
110 | 137 |
Observer o = (Observer)ref.get(); |
111 | 138 |
obs.removeElement(ref); |
112 |
if (o == null) |
|
113 |
return; |
|
139 |
if (o == null) { |
|
140 |
return; |
|
141 |
} |
|
114 | 142 |
deleteObserverReferenced(o); |
115 | 143 |
} |
116 | 144 |
|
... | ... | |
288 | 316 |
* 2) a recently unregistered Observer will be |
289 | 317 |
* wrongly notified when it doesn't care |
290 | 318 |
*/ |
291 |
if (!changed) |
|
292 |
return; |
|
319 |
if (!changed) { |
|
320 |
return; |
|
321 |
} |
|
293 | 322 |
arrLocal = obs.toArray(); |
294 | 323 |
clearChanged(); |
295 | 324 |
} |
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/observer/ComplexNotification.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.observer; |
2 | 28 |
|
3 | 29 |
import java.util.ArrayList; |
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/visitor/Visitor.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.visitor; |
2 | 28 |
|
3 | 29 |
import org.gvsig.tools.exception.BaseException; |
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/visitor/Visitable.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
1 | 27 |
package org.gvsig.tools.visitor; |
2 | 28 |
|
3 | 29 |
import org.gvsig.tools.exception.BaseException; |
... | ... | |
3 | 29 |
|
4 | 30 |
public interface Visitable { |
5 |
|
|
31 |
|
|
6 | 32 |
public void accept(Visitor visitor) throws BaseException; |
7 | 33 |
|
branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/visitor/NotSupportedOperationException.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import org.gvsig.tools.exception.BaseException; |
7 | 7 |
|
8 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
8 |
/* gvSIG. Geographic Information System of the Valencian Government
|
|
9 | 9 |
* |
10 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
11 |
* of the Valencian Government (CIT) |
|
11 | 12 |
* |
12 | 13 |
* This program is free software; you can redistribute it and/or |
13 | 14 |
* modify it under the terms of the GNU General Public License |
... | ... | |
21 | 22 |
* |
22 | 23 |
* You should have received a copy of the GNU General Public License |
23 | 24 |
* along with this program; if not, write to the Free Software |
24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 |
* MA 02110-1301, USA. |
|
25 | 27 |
* |
26 |
* For more information, contact: |
|
27 |
* |
|
28 |
* Generalitat Valenciana |
|
29 |
* Conselleria d'Infraestructures i Transport |
|
30 |
* Av. Blasco Ib??ez, 50 |
|
31 |
* 46010 VALENCIA |
|
32 |
* SPAIN |
|
33 |
* |
|
34 |
* +34 963862235 |
|
35 |
* gvsig@gva.es |
|
36 |
* www.gvsig.gva.es |
|
37 |
* |
|
38 |
* or |
|
39 |
* |
|
40 |
* IVER T.I. S.A |
|
41 |
* Salamanca 50 |
|
42 |
* 46005 Valencia |
|
43 |
* Spain |
|
44 |
* |
|
45 |
* +34 963163400 |
|
46 |
* dac@iver.es |
|
47 | 28 |
*/ |
48 |
/* CVS MESSAGES: |
|
49 |
* |
|
50 |
* $Id$ |
|
51 |
* $Log$ |
|
52 |
* |
|
29 |
|
|
30 |
/* |
|
31 |
* AUTHORS (In addition to CIT): |
|
32 |
* 2008 IVER T.I. S.A. {{Task}} |
|
53 | 33 |
*/ |
54 | 34 |
/** |
55 | 35 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es) |
... | ... | |
58 | 38 |
private static final long serialVersionUID = 1L; |
59 | 39 |
private String visitorClassName = null; |
60 | 40 |
private String objectClassName = null; |
61 |
|
|
41 |
|
|
62 | 42 |
public NotSupportedOperationException(Visitor visitor, Object object){ |
63 | 43 |
this.visitorClassName = visitor.getClass().getName(); |
64 | 44 |
this.objectClassName = object.getClass().getName(); |
65 | 45 |
} |
66 |
|
|
46 |
|
|
67 | 47 |
/** |
68 | 48 |
* Initializes some values |
69 | 49 |
*/ |
... | ... | |
73 | 53 |
"operation for the object %(objectClassName)"; |
74 | 54 |
code = serialVersionUID; |
75 | 55 |
} |
76 |
|
|
56 |
|
|
77 | 57 |
/* |
78 | 58 |
* (non-Javadoc) |
79 | 59 |
* @see org.gvsig.exceptions.BaseException#values() |
Also available in: Unified diff