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