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