1 package com.nexuiz.demorecorder.ui.swinggui;
\r
5 import com.nexuiz.demorecorder.application.DemoRecorderException;
\r
6 import com.nexuiz.demorecorder.application.jobs.RecordJob;
\r
8 public class RecordJobTemplate extends RecordJob {
\r
10 private static final long serialVersionUID = 8311386509410161395L;
\r
11 private String templateName;
\r
12 private String summary;
\r
14 public RecordJobTemplate(
\r
15 String templateName,
\r
19 String engineParameters,
\r
21 String relativeDemoPath,
\r
23 File videoDestination,
\r
24 String executeBeforeCap,
\r
25 String executeAfterCap
\r
30 * Differences to jobs:
\r
31 * - name and summary exist
\r
32 * - "Demo file:" -> "Demo directory:"
\r
33 * - no start/end second
\r
36 if (templateName == null || summary == null || jobName == null || enginePath == null || engineParameters == null ||
\r
37 demoFile == null || relativeDemoPath == null || dpVideoPath == null || videoDestination == null
\r
38 || executeBeforeCap == null || executeAfterCap == null) {
\r
39 throw new DemoRecorderException("Error: Make sure that you filled the necessary fields! (file choosers!)");
\r
42 this.templateName = templateName;
\r
43 this.summary = summary;
\r
44 this.jobName = jobName;
\r
45 this.enginePath = enginePath;
\r
46 this.engineParameters = engineParameters;
\r
47 this.demoFile = demoFile;
\r
48 this.relativeDemoPath = relativeDemoPath;
\r
49 this.dpVideoPath = dpVideoPath;
\r
50 this.videoDestination = videoDestination;
\r
51 this.executeBeforeCap = executeBeforeCap;
\r
52 this.executeAfterCap = executeAfterCap;
\r
55 public String getName() {
\r
56 return templateName;
\r
59 public String getSummary() {
\r
63 public void setName(String name) {
\r
64 this.templateName = name;
\r
67 public void setSummary(String summary) {
\r
68 this.summary = summary;
\r
73 * Overwrite this method because here we want to do the read/write test for the path directly
\r
74 * (as this one already is the directory), and not its parent directory.
\r
75 * @see com.nexuiz.demorecorder.application.jobs.RecordJob#setDemoFile(java.io.File)
\r
77 public void setDemoFile(File demoFile) {
\r
78 if (demoFile == null || !demoFile.exists()) {
\r
79 throw new DemoRecorderException("Could not locate demo file!");
\r
81 if (!doReadWriteTest(demoFile)) {
\r
82 throw new DemoRecorderException("The directory you specified for the demo to be recorded is not writable!");
\r
84 this.demoFile = demoFile.getAbsoluteFile();
\r
89 * Overwrite this method because here we want to do the read/write test for the path directly
\r
90 * (as this one already is the directory), and not its parent directory.
\r
91 * @see com.nexuiz.demorecorder.application.jobs.RecordJob#setVideoDestination(java.io.File)
\r
93 public void setVideoDestination(File videoDestination) {
\r
94 //keep in mind, here videoDestination points to the destination directory, not the destination file
\r
95 if (videoDestination == null || !videoDestination.isDirectory()) {
\r
96 throw new DemoRecorderException("Could not locate the specified video destination directory");
\r
99 if (!this.doReadWriteTest(videoDestination)) {
\r
100 throw new DemoRecorderException("The video destination directory is not writable! It needs to be writable so that the file can be moved to its new location");
\r
103 this.videoDestination = videoDestination.getAbsoluteFile();
\r
106 public String getJobName() {
\r
107 return this.jobName;
\r
110 public void setJobName(String jobName) {
\r
111 this.jobName = jobName;
\r