-
Notifications
You must be signed in to change notification settings - Fork 2
/
EmbedAction.java
executable file
·73 lines (65 loc) · 2.92 KB
/
EmbedAction.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
public class EmbedAction implements WizardButtonListener
{
public WizardFrame wf;
public SelectInputFile sif;
public SelectOutputDirectory sof;
public SelectDataToEmbed sdte;
public EnterOtherOptions eoo;
public EmbedExtractOptions options;
public VerifyOptions vo;
public ShowProcessDetails sepd;
public ShowEmbeddedFile sopf;
DHMain mm;
public EmbedAction(DHMain m) {
mm=m;
wf = new WizardFrame("Embed Wizard",m);
wf.addWizardButtonListener(this);
sif = new SelectInputFile("1. Select an input audio file");
wf.addWizPanel(sif);
sof = new SelectOutputDirectory("2. Select an output directory");
wf.addWizPanel(sof);
sdte = new SelectDataToEmbed("3. Select data to embed");
wf.addWizPanel(sdte);
eoo = new EnterOtherOptions("4. Enter password/comment/quality");
wf.addWizPanel(eoo);
vo = new VerifyOptions("5. Verify Options");
wf.addWizPanel(vo);
sepd = new ShowProcessDetails("6. Embedding data into the audio");
wf.addWizPanel(sepd);
sopf = new ShowEmbeddedFile("7. View Output File");
wf.addWizPanel(sopf);
wf.fireSetFocus(0,1);
}
public WizardFrame getWizardFrame() {
return wf;
}
public void buttonClicked(WizardButtonEvent wbe) {
if( wbe.getButtonType() == WizardButtonListener.NEXT && wbe.getCard() == eoo ){
options = new EmbedExtractOptions();
options.setInputFile( sif.getSelectedFile() );
options.setOutputDirectory( sof.getOutputDirectory() );
options.setEmbedTextOrFile( sdte.isTextOrFile() );
if( sdte.isTextOrFile() ){
options.setEmbedText( sdte.getEmbeddedText() );
}else{
options.setEmbedFile( sdte.getSelectedFile() );
}
options.setPassword( eoo.getPassword() );
options.setComment( eoo.getComment() );
options.setQuality( eoo.getQuality() );
options.createEmbedColumnData();
vo.showChosenOptions(options);
}else if( wbe.getButtonType() == WizardButtonListener.NEXT && wbe.getCard() == vo ){
EmbedProcess process = new EmbedProcess(options);
java.io.ByteArrayOutputStream outBuffer = new java.io.ByteArrayOutputStream();
java.io.OutputStream out = System.out;
System.setOut( new java.io.PrintStream(outBuffer) );
process.startEmbed();
System.out.println("Embedding Process Completed.");
System.setOut( System.out );
sepd.addOutputLine(new String(outBuffer.toByteArray()));
}else if( wbe.getButtonType() == WizardButtonListener.NEXT && wbe.getCard() == sepd ){
sopf.setImageFiles(options.getInputFile(),options.getOutputFile());
}
}
}