root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / util / GvSession.java @ 34288
History | View | Annotate | Download (1.08 KB)
1 |
package org.gvsig.app.util; |
---|---|
2 |
|
3 |
|
4 |
import java.util.Map; |
5 |
|
6 |
import org.gvsig.fmap.mapcontrol.MapControl; |
7 |
|
8 |
import com.vividsolutions.jump.util.Blackboard; |
9 |
|
10 |
|
11 |
/**
|
12 |
*
|
13 |
* Prototype of user's session.
|
14 |
*
|
15 |
* This class will save information of the
|
16 |
* user session, to recover later.
|
17 |
*
|
18 |
* The key of the session will be the Andami's view
|
19 |
* (to allows a user to save different user sessions
|
20 |
* for different views)
|
21 |
* */
|
22 |
|
23 |
public class GvSession { |
24 |
private final static GvSession session = new GvSession(); |
25 |
|
26 |
Blackboard blackboard = new Blackboard();
|
27 |
|
28 |
private GvSession(){}
|
29 |
|
30 |
public static GvSession getInstance(){ |
31 |
return session;
|
32 |
} |
33 |
|
34 |
public void put(MapControl map, String key, Object sessionObject){ |
35 |
String gKey = map.toString() + ":" + key; |
36 |
blackboard.put(gKey, sessionObject ); |
37 |
} |
38 |
|
39 |
public Object get(MapControl map, String key){ |
40 |
return blackboard.get(map.toString() + ":" + key); |
41 |
} |
42 |
|
43 |
public void delete(MapControl map, String key){ |
44 |
Map props = blackboard.getProperties();
|
45 |
String newKey = map.toString()+":"+key; |
46 |
if(props.containsKey(newKey))
|
47 |
{ |
48 |
props.remove(newKey); |
49 |
} |
50 |
|
51 |
} |
52 |
|
53 |
|
54 |
} |
55 |
|