gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.swing / org.gvsig.scripting.swing.impl / src / main / java / org / gvsig / scripting / swing / impl / composer / JNewScriptModel.java @ 468
History | View | Annotate | Download (1.97 KB)
1 |
package org.gvsig.scripting.swing.impl.composer; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import org.gvsig.scripting.ScriptingFolder; |
6 |
import org.gvsig.scripting.ScriptingManager; |
7 |
|
8 |
public class JNewScriptModel { |
9 |
|
10 |
public final static int ACTION_CANCEL = 0; |
11 |
public final static int ACTION_ACCEPT = 1; |
12 |
|
13 |
private String type; |
14 |
private String name; |
15 |
private String description; |
16 |
private String language; |
17 |
private String path; |
18 |
private String createdBy; |
19 |
private String version; |
20 |
private int action; |
21 |
private ScriptingManager manager;
|
22 |
|
23 |
public JNewScriptModel(ScriptingManager manager){
|
24 |
this.manager = manager;
|
25 |
} |
26 |
|
27 |
public void validate() throws Exception{ |
28 |
if(this.getName().length()==0){ |
29 |
throw new Exception( "Name must not be empty."); |
30 |
} |
31 |
|
32 |
ScriptingFolder folder = manager.getFolder(new File(this.getPath())); |
33 |
if(!manager.validateUnitId(folder,this.getName())){ |
34 |
throw new Exception("This file already exists.\nWrite another name for the script"); |
35 |
} |
36 |
} |
37 |
|
38 |
public String getExtension(){ |
39 |
return manager.getExtensionOfLanguage(this.getLanguage()); |
40 |
} |
41 |
|
42 |
public void setVersion(String version) { |
43 |
this.version = version;
|
44 |
} |
45 |
public String getVersion() { |
46 |
return version;
|
47 |
} |
48 |
public void setCreatedBy(String createdBy) { |
49 |
this.createdBy = createdBy;
|
50 |
} |
51 |
public String getCreatedBy() { |
52 |
return createdBy;
|
53 |
} |
54 |
public void setPath(String path) { |
55 |
this.path = path;
|
56 |
} |
57 |
public String getPath() { |
58 |
return path;
|
59 |
} |
60 |
public void setLanguage(String language) { |
61 |
this.language = language;
|
62 |
} |
63 |
public String getLanguage() { |
64 |
return language;
|
65 |
} |
66 |
public void setDescription(String description) { |
67 |
this.description = description;
|
68 |
} |
69 |
public String getDescription() { |
70 |
return description;
|
71 |
} |
72 |
public void setName(String name) { |
73 |
this.name = name;
|
74 |
} |
75 |
public String getName() { |
76 |
return name;
|
77 |
} |
78 |
public void setType(String type) { |
79 |
this.type = type;
|
80 |
} |
81 |
public String getType() { |
82 |
return type;
|
83 |
} |
84 |
public void setAction(int action) { |
85 |
this.action = action;
|
86 |
} |
87 |
public int getAction() { |
88 |
return action;
|
89 |
} |
90 |
|
91 |
} |