gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.lib / org.gvsig.scripting.lib.impl / src / main / java / org / gvsig / scripting / impl / AbstractScript.java @ 724
History | View | Annotate | Download (1.92 KB)
1 |
package org.gvsig.scripting.impl; |
---|---|
2 |
|
3 |
import org.apache.commons.lang3.BooleanUtils; |
4 |
import org.gvsig.scripting.ScriptingBaseScript; |
5 |
import org.gvsig.scripting.ScriptingFolder; |
6 |
import org.gvsig.scripting.ScriptingManager; |
7 |
import org.ini4j.Ini; |
8 |
|
9 |
public abstract class AbstractScript extends AbstractUnit implements ScriptingBaseScript{ |
10 |
protected boolean enabled; |
11 |
protected int isolation; |
12 |
|
13 |
public AbstractScript(ScriptingFolder parent, String typename, ScriptingManager manager, String id) { |
14 |
super(parent, typename, manager, id);
|
15 |
this.enabled = true; |
16 |
} |
17 |
|
18 |
@Override
|
19 |
public boolean isEnabled() { |
20 |
return this.enabled; |
21 |
} |
22 |
|
23 |
@Override
|
24 |
public void setEnabled(boolean enabled) { |
25 |
firePropertyChangeListener("enabled", enabled, this.enabled); |
26 |
this.enabled = enabled;
|
27 |
} |
28 |
|
29 |
|
30 |
@Override
|
31 |
public int getIsolation() { |
32 |
return this.isolation; |
33 |
} |
34 |
|
35 |
@Override
|
36 |
public void setIsolation(int isolation) { |
37 |
firePropertyChangeListener("isolation", isolation, this.isolation); |
38 |
this.isolation = isolation;
|
39 |
} |
40 |
|
41 |
@Override
|
42 |
protected void save(Ini prefs){ |
43 |
prefs.put("script", "enable", BooleanUtils.toStringTrueFalse(this.enabled)); |
44 |
prefs.put("script", "isolation", this.isolation); |
45 |
super.save(prefs);
|
46 |
} |
47 |
|
48 |
@Override
|
49 |
protected void loadInf(Ini prefs){ |
50 |
super.loadInf(prefs);
|
51 |
this.enabled = this.getInfBoolean(prefs,"script","enable", true); |
52 |
this.isolation = this.getInfInt(prefs,"script","isolation", 0); |
53 |
switch(this.isolation) { |
54 |
case ISOLATION_LOW:
|
55 |
case ISOLATION_HIGH:
|
56 |
break;
|
57 |
default:
|
58 |
this.isolation = ISOLATION_LOW;
|
59 |
} |
60 |
} |
61 |
|
62 |
|
63 |
|
64 |
} |