forked from guide-me/GuideMe
/
OverRide.java
1016 lines (935 loc) · 32.6 KB
/
OverRide.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package org.guideme.guideme.scripting;
import java.util.ArrayList;
import org.eclipse.swt.widgets.Display;
import org.guideme.guideme.model.*;
public class OverRide {
/** @exclude */
private ArrayList<Button> button = new ArrayList<Button>();
/** @exclude */
private ArrayList<GlobalButton> globalButton = new ArrayList<GlobalButton>();
/** @exclude */
private ArrayList<WebcamButton> webcamButton = new ArrayList<WebcamButton>();
/** @exclude */
private ArrayList<Timer> timer = new ArrayList<Timer>();
/** @exclude */
private Delay delay = null;
/** @exclude */
private Video video = null;
/** @exclude */
private Webcam webcam = null;
/** @exclude */
private Audio audio = null;
/** @exclude */
private Audio audio2 = null;
/** @exclude */
private Metronome metronome = null;
/** @exclude */
private String image = "";
/** @exclude */
private String html = "";
/** @exclude */
private String rightHtml = "";
/** @exclude */
private String page = "";
/** @exclude */
private String leftHtml = "";
/** @exclude */
private String leftBody = "";
/** @exclude */
private String rightCss = "";
/** @exclude */
private String leftCss = "";
/**
* Adds a button to the page
*
* @param target the page to go to
* @param text the text to be displayed on the button
*/
public void addButton(String target, String text) {
addButton(target, text, "", "", "", "", "");
}
/**
* Adds a button to the page
*
* @param target the page to go to
* @param text the text to display on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
*/
public void addButton(String target, String text, String set, String unSet, String jScript, String image) {
addButton(target, text, set, unSet, jScript, image, "");
}
/**
* Adds a button to the page
*
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
*/
public void addButton(String target, String text, String set, String unSet, String jScript, String image, String hotKey) {
ButtonThread buttonThread = new ButtonThread();
buttonThread.overRide = this;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
Display.getDefault().syncExec(buttonThread);
}
private class ButtonThread implements Runnable
{
public OverRide overRide;
public String target;
public String text;
public String set;
public String unSet;
public String jScript;
public String image;
public String hotKey;
public void run()
{
Button button = new Button(target, text, "", "", set, unSet, jScript, image, hotKey);
overRide.button.add(button);
}
}
/**
* Adds a button to the page
*
* @param target the page to go to
* @param text the text displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param sortOrder the sort order value (used to sort the buttons)
* @param disabled the disabled state of the button (true to disable it)
* @param id the id to use to manipulate the button from Java Script
*/
public void addButton(String target, String text, String set, String unSet, String jScript, String image, String hotKey, String sortOrder, boolean disabled, String id) {
int order;
try {
order = Integer.parseInt(sortOrder);
} catch (Exception e) {
order = 1;
}
ButtonThread2 buttonThread = new ButtonThread2();
buttonThread.overRide = this;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
buttonThread.order = order;
buttonThread.disabled = disabled;
buttonThread.id = id;
buttonThread.defaultBtn = false;
Display.getDefault().syncExec(buttonThread);
}
/**
* Adds a button to the page
*
* @param target the page to go to
* @param text the text displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param sortOrder the sort order value (used to sort the buttons)
* @param disabled the disabled state of the button (true to disable it)
* @param id the id to use to manipulate the button from Java Script
* @param defaultBtn default button activated when enter is pressed
*/
public void addButton(String target, String text, String set, String unSet, String jScript, String image, String hotKey, String sortOrder, boolean disabled, String id, boolean defaultBtn) {
int order;
try {
order = Integer.parseInt(sortOrder);
} catch (Exception e) {
order = 1;
}
ButtonThread2 buttonThread = new ButtonThread2();
buttonThread.overRide = this;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
buttonThread.order = order;
buttonThread.disabled = disabled;
buttonThread.id = id;
buttonThread.defaultBtn = defaultBtn;
Display.getDefault().syncExec(buttonThread);
}
private class ButtonThread2 implements Runnable
{
public OverRide overRide;
public String target;
public String text;
public String set;
public String unSet;
public String jScript;
public String image;
public String hotKey;
public int order;
public boolean disabled;
public String id;
public boolean defaultBtn;
public void run()
{
Button button = new Button(target, text, "", "", set, unSet, jScript, image, hotKey, "", "", "", "", "", order, "", "", disabled, id, "", defaultBtn);
overRide.button.add(button);
}
}
/** @exclude */
public Button getButton(int i) {
return button.get(i);
}
/** @exclude */
public int buttonCount() {
return button.size();
}
/**
* Adds a global button to the page
*
* @param id the id of the button
* @param target the page to go to
* @param text the text to be displayed on the button
*/
public void addGlobalButton(String id, String target, String text) {
addGlobalButton(id, target, text, "", "", "", "", "", "bottom", "1");
}
/**
* Adds a global button to the page
*
* @param id the id of the button
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
*/
public void addGlobalButton(String id, String target, String text, String set, String unSet, String jScript, String image) {
addGlobalButton(id, target, text, set, unSet, jScript, image, "", "bottom", "1");
}
/**
* Adds a global button to the page
*
* @param id the id of the button
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
*/
public void addGlobalButton(String id, String target, String text, String set, String unSet, String jScript, String image, String hotKey) {
addGlobalButton(id, target, text, set, unSet, jScript, image, hotKey, "bottom", "1");
}
/**
* Adds a global button to the page
*
* @param id the id of the button
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param placement the placement of the global button, top or bottom
*/
public void addGlobalButton(String id, String target, String text, String set, String unSet, String jScript, String image, String hotKey, String placement) {
addGlobalButton(id, target, text, set, unSet, jScript, image, hotKey, placement, "1");
}
/**
* Adds a global button to the page
*
* @param id the id of the button
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param placement the placement of the global button, top or bottom
* @param sortOrder the sort order value (used to sort the buttons)
*/
public void addGlobalButton(String id, String target, String text, String set, String unSet, String jScript, String image, String hotKey, String placement, String sortOrder) {
GlobalButtonThread buttonThread = new GlobalButtonThread();
buttonThread.overRide = this;
buttonThread.id = id;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
buttonThread.sortOrder = sortOrder;
buttonThread.placement = placement;
buttonThread.action = GlobalButton.Action.ADD;
Display.getDefault().syncExec(buttonThread);
}
/**
* Removes a global button from the page
*
* @param id the id of the button
*/
public void removeGlobalButton(String id) {
GlobalButtonThread buttonThread = new GlobalButtonThread();
buttonThread.overRide = this;
buttonThread.id = id;
buttonThread.target = "";
buttonThread.text = "";
buttonThread.set = "";
buttonThread.unSet = "";
buttonThread.jScript = "";
buttonThread.image = "";
buttonThread.hotKey = "";
buttonThread.sortOrder = "";
buttonThread.placement = "";
buttonThread.action = GlobalButton.Action.REMOVE;
Display.getDefault().syncExec(buttonThread);
}
private class GlobalButtonThread implements Runnable
{
public OverRide overRide;
public String id;
public String target;
public String text;
public String set;
public String unSet;
public String jScript;
public String image;
public String hotKey;
public String sortOrder;
public String placement;
public GlobalButton.Action action;
public void run()
{
GlobalButton.Placement placement = this.placement.equals("top")
? GlobalButton.Placement.TOP
: GlobalButton.Placement.BOTTOM;
int iSortOrder;
try {
iSortOrder = Integer.parseInt(sortOrder);
}
catch (NumberFormatException e) {
iSortOrder = 1;
}
GlobalButton button = new GlobalButton(id, target, text, "", "", set, unSet, jScript, image, hotKey, iSortOrder, placement, action);
overRide.globalButton.removeIf(btn -> btn.getId().equals(id));
overRide.globalButton.add(button);
}
}
/** @exclude */
public GlobalButton getGlobalButton(int i) {
return globalButton.get(i);
}
/** @exclude */
public int globalButtonCount() {
return globalButton.size();
}
/** @exclude */
public void clearGlobalButtons() { globalButton.clear(); }
/**
* Adds a webcam button to the page
*
* @param type Capture
* @param file file name and location to save the captured image / video
* @param target the page to go to
* @param text the text to display on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
*/
public void addWebcamButton(String type, String file, String target, String text, String set, String unSet, String jScript, String image) {
addWebcamButton(type, file, target, text, set, unSet, jScript, image, "");
}
/**
* Adds a webcam button to the page
*
* @param type Capture
* @param file file name and location to save the captured image / video
* @param target the page to go to
* @param text the text to be displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
*/
public void addWebcamButton(String type, String file, String target, String text, String set, String unSet, String jScript, String image, String hotKey) {
WebcamButtonThread buttonThread = new WebcamButtonThread();
buttonThread.overRide = this;
buttonThread.type = type;
buttonThread.file = file;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
Display.getDefault().syncExec(buttonThread);
}
private class WebcamButtonThread implements Runnable
{
public OverRide overRide;
public String file;
public String type;
public String target;
public String text;
public String set;
public String unSet;
public String jScript;
public String image;
public String hotKey;
public void run()
{
WebcamButton button = new WebcamButton(type, file, target, text, "", "", set, unSet, jScript, image, hotKey);
overRide.webcamButton.add(button);
}
}
/**
* Adds a webcam button to the page
*
* @param type Capture
* @param file file name and location to save the captured image / video
* @param target the page to go to
* @param text the text displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param sortOrder the sort order value (used to sort the buttons)
* @param disabled the disabled state of the button (true to disable it)
* @param id the id to use to manipulate the button from Java Script
*/
public void addWebcamButton(String type, String file, String target, String text, String set, String unSet, String jScript, String image, String hotKey, String sortOrder, boolean disabled, String id) {
int order;
try {
order = Integer.parseInt(sortOrder);
} catch (Exception e) {
order = 1;
}
WebcamButtonThread2 buttonThread = new WebcamButtonThread2();
buttonThread.overRide = this;
buttonThread.type = type;
buttonThread.file = file;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
buttonThread.order = order;
buttonThread.disabled = disabled;
buttonThread.id = id;
buttonThread.defaultBtn = false;
Display.getDefault().syncExec(buttonThread);
}
/**
* Adds a webcam button to the page
*
* @param type Capture
* @param file file name and location to save the captured image / video
* @param target the page to go to
* @param text the text displayed on the button
* @param set the flags to set if the button is pressed
* @param unSet the flags to clear if the button is pressed
* @param jScript the Java Script function to run if the button is pressed
* @param image the background image for the button
* @param hotKey the hot key assigned to the button
* @param sortOrder the sort order value (used to sort the buttons)
* @param disabled the disabled state of the button (true to disable it)
* @param id the id to use to manipulate the button from Java Script
* @param defaultBtn default button activated when enter is pressed
*/
public void addWebcamButton(String type, String file, String target, String text, String set, String unSet, String jScript, String image, String hotKey, String sortOrder, boolean disabled, String id, boolean defaultBtn) {
int order;
try {
order = Integer.parseInt(sortOrder);
} catch (Exception e) {
order = 1;
}
WebcamButtonThread2 buttonThread = new WebcamButtonThread2();
buttonThread.overRide = this;
buttonThread.type = type;
buttonThread.file = file;
buttonThread.target = target;
buttonThread.text = text;
buttonThread.set = set;
buttonThread.unSet = unSet;
buttonThread.jScript = jScript;
buttonThread.image = image;
buttonThread.hotKey = hotKey;
buttonThread.order = order;
buttonThread.disabled = disabled;
buttonThread.id = id;
buttonThread.defaultBtn = defaultBtn;
Display.getDefault().syncExec(buttonThread);
}
private class WebcamButtonThread2 implements Runnable
{
public OverRide overRide;
public String type;
public String file;
public String target;
public String text;
public String set;
public String unSet;
public String jScript;
public String image;
public String hotKey;
public int order;
public boolean disabled;
public String id;
public boolean defaultBtn;
public void run()
{
WebcamButton button = new WebcamButton(type, file, target, text, "", "", set, unSet, jScript, image, hotKey, "", "", "", "", "", order, "", "", disabled, id, "", defaultBtn);
overRide.webcamButton.add(button);
}
}
/** @exclude */
public WebcamButton getWebcamButton(int i) {
return webcamButton.get(i);
}
/** @exclude */
public int webcamButtonCount() {
return webcamButton.size();
}
/**
* Adds a timer to change various aspects of the screen / run a javascript function
*
* @param delay the time in seconds before the timer triggers
* @param jScript the Java Script function to run when the timer triggers
* @param imageId the image to change to when the timer triggers
* @param text the html to set the right html pane to when the timer triggers
* @param set the flags to set when the timer triggers
* @param unSet the flags to clear when the timer triggers
*/
public void addTimer(String delay, String jScript, String imageId, String text, String set, String unSet, String id) {
Timer timer = new Timer(delay, jScript, imageId, text, "", "", set, unSet, "", "", id);
this.timer.add(timer);
}
/** @exclude */
public Timer getTimer(int i) {
return timer.get(i);
}
/** @exclude */
public int timerCount() {
return timer.size();
}
/** @exclude */
public void clear() {
button = new ArrayList<Button>();
timer = new ArrayList<Timer>();
delay = null;
video = null;
audio = null;
audio2 = null;
metronome = null;
image = "";
html = "";
page = "";
leftHtml = "";
leftBody = "";
rightCss = "";
rightHtml = "";
}
/** @exclude */
public Delay getDelay() {
return delay;
}
/**
* Add a delay / count down timer
*
* @param target the page to go to if the delay counts down to 0
* @param delay the number of seconds for the delay
* Can be a range specify (n..n2) e.g. (5..10) for a random delay between 5 and 10 seconds
* @param startWith Don't show the true value but start with a higher one
* e.g. setting this to 50 with a 5 second delay would show a count starting at 50 but would reach 0 while displaying 45 seconds to go
* @param style Display style
* N Normal display the count down timer
* S Secret display ??:?? so user knows there is a timer
* H Hidden don't display anything
* @param set the flags to set if the delay counts down to 0
* @param unSet the flags to clear if delay counts down to 0
* @param jScript the Java Script function to run if delay counts down to 0
*/
public void setDelay(String target, String delay, String startWith, String style, String set, String unSet, String jScript) {
this.delay = new Delay(target, delay, "", "", startWith, style, set, unSet, jScript, "", "", "");
}
/** @exclude */
public Video getVideo() {
return video;
}
/**
* Play a video
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select a video in the sub directory kate with a file name starting with home
*
* @param id the file name for the video
*/
public void setVideo(String id) {
this.video = new Video(id, "", "", "", "", "", "", "", "", "", "", "", "", 100);
}
/**
* Play a video
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select a video in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in use 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
* @param id the file name for the video
* @param startAt the Start time for the video hh:mm:ss
* @param stopAt the Stop time for video hh:mm:ss
* @param target the page to go to when the video stops
* @param set the flags to set when the video ends
* @param unSet the flags to clear when the video ends
* @param repeat the number of times to repeat the video
* @param jscript the Java Script function to run when the video stops
*/
public void setVideo(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript) {
this.video = new Video(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", 100);
}
/**
* Play a video
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select a video in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in use 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
* @param id the file name for the video
* @param startAt the Start time for the video hh:mm:ss
* @param stopAt the Stop time for video hh:mm:ss
* @param target the page to go to when the video stops
* @param set the flags to set when the video ends
* @param unSet the flags to clear when the video ends
* @param repeat the number of times to repeat the video
* @param jscript the Java Script function to run when the video stops
* @param volume number between 0 and 100 to set the volume of the audio
*/
public void setVideo(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript, int volume) {
this.video = new Video(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", volume);
}
/** @exclude */
public Webcam getWebcam() {
return webcam;
}
/**
* Display Webcam output
*
*/
public void setWebcam() {
this.webcam = new Webcam("", "","", "");
}
/** @exclude */
public Audio getAudio() {
return audio;
}
/**
* Play an audio file
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* @param id the file name for the audio
*/
public void setAudio(String id) {
this.audio = new Audio(id, "", "", "", "", "", "", "", "", "", "", "", "", 100);
}
/**
* Play an audio file
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
*
* @param id the file name for the audio
* @param startAt the start time for the audio hh:mm:ss
* @param stopAt the stop time for audio hh:mm:ss
* @param target the page to go to when the audio stops
* @param set the flags to set when the audio ends
* @param unSet the flags to clear when the audio ends
* @param repeat the number of times to repeat the audio
* @param jscript the Java Script function to run when the audio stops
*/
public void setAudio(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript) {
this.audio = new Audio(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", 100);
}
/**
* Play an audio file
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
*
* @param id the file name for the audio
* @param startAt the start time for the audio hh:mm:ss
* @param stopAt the stop time for audio hh:mm:ss
* @param target the page to go to when the audio stops
* @param set the flags to set when the audio ends
* @param unSet the flags to clear when the audio ends
* @param repeat the number of times to repeat the audio
* @param jscript the Java Script function to run when the audio stops
* @param volume number between 0 and 100 to set the volume of the audio
*/
public void setAudio(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript, int volume) {
this.audio = new Audio(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", volume);
}
/** @exclude */
public Audio getAudio2() {
return audio2;
}
/**
* Play an audio file on Audio2
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* @param id the file name for the audio
*/
public void setAudio2(String id) {
this.audio2 = new Audio(id, "", "", "", "", "", "", "", "", "", "", "", "", 100);
}
/**
* Play an audio file on Audio2
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
*
* @param id the file name for the audio
* @param startAt the start time for the audio hh:mm:ss
* @param stopAt the stop time for audio hh:mm:ss
* @param target the page to go to when the audio stops
* @param set the flags to set when the audio ends
* @param unSet the flags to clear when the audio ends
* @param repeat the number of times to repeat the audio
* @param jscript the Java Script function to run when the audio stops
*/
public void setAudio2(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript) {
this.audio2 = new Audio(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", 100);
}
/**
* Play an audio file on Audio2
*
* id :
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an audio file in the sub directory kate with a file name starting with home
*
* startAt : to start 90 seconds in 00:01:30
* stopAt : to stop at 95 seconds into the video 00:01:35
*
*
* @param id the file name for the audio
* @param startAt the start time for the audio hh:mm:ss
* @param stopAt the stop time for audio hh:mm:ss
* @param target the page to go to when the audio stops
* @param set the flags to set when the audio ends
* @param unSet the flags to clear when the audio ends
* @param repeat the number of times to repeat the audio
* @param jscript the Java Script function to run when the audio stops
* @param volume number between 0 and 100 to set the volume of the audio
*/
public void setAudio2(String id, String startAt, String stopAt, String target, String set, String unSet, String repeat, String jscript, int volume) {
this.audio2 = new Audio(id, startAt, stopAt, target, "", "", set, unSet, repeat, jscript, "", "", "", volume);
}
/** @exclude */
public Metronome getMetronome() {
return metronome;
}
/**
* Play a metronome beat
*
* defaults for a simple beats per minute
* bpm : the number of beats per minute
* resolution : 4
* loops : 0
* rhythm : ""
*
* For complex beat patterns you need to set bpm, resolution and rhythm
* If bpm=60 and beats=4, we have 1 bar per second with 4 beats per bar, so a beat every 0.25 seconds
* If rhythm="1,5,9,13" we get 4 clicks once per second
* If rhythm="1,3,5,7,9,11,13" we get 7 clicks once every half second
*
* bpm : can also be a range (30..60) will give a random BPM between 30 and 60
*
* @param bpm Beats per minute 60 will give one beat per second
* @param resolution Beats per bar (for a "normal" bpm this should be set to 4)
* @param loops Number of times to loop the rhythm
* @param rhythm list of numbers to set the beat pattern
*
*/
public void setMetronome(String bpm, int resolution, int loops, String rhythm) {
this.metronome = new Metronome(bpm, "", "", resolution, loops, rhythm, "", "");
}
/**
* Play a metronome beat
*
* bpm :
* Beats per minute, 60 will give one beat per second
* can also be a range (30..60) will give a random BPM between 30 and 60
*
* @param bpm the number of beats
*/
public void setMetronome(String bpm) {
this.metronome = new Metronome(bpm, "", "", 4, 0, "", "", "");
}
/** @exclude */
public String getHtml() {
return html;
}
/**
* Sets the html for the right hand pane
*
* @param html the Html to put in the right pane
*/
public void setHtml(String html) {
this.html = html;
}
/** @exclude */
public String getImage() {
return image;
}
/**
* Sets the image to be displayed in the left pane
*
* File must be in the media directory (or subdirectory)
* Wild cards can be used
* e.g. kate/home*.* would select an image in the sub directory kate with a file name starting with home
*
* @param id the file name for the image
*/
public void setImage(String id) {
this.image = id;
}
/** @exclude */
public String getPage() {
return page;
}
/**
* Over rides the page to go to
*
* Setting this will force a jump to the page
*
* @param page the page to go to
*/
public void setPage(String page) {
this.page = page;
}
/** @exclude */
public String getLeftHtml() {
return leftHtml;
}
/**
* Will set the left pane to the html provided
*
* Instead of displaying an image the left pane it will display the html
*
* @param leftHtml the Html to be displayed in the left pane
*/
public void setLeftHtml(String leftHtml) {
this.leftHtml = leftHtml;
}
/** @exclude */
public String getRightCss() {
return rightCss;
}
/**
* Over rides the CSS for the right pane
*
* @param rightCss the CSS to use instead of the default
*/
public void setRightCss(String rightCss) {
this.rightCss = rightCss;
}
/** @exclude */
public String getLeftBody() {
return leftBody;
}
/**
* Sets the content of the body node for the left pane
*
* Rather than over ride the whole html this can be used to set just the body
* This will function in exactly the same way as setting the right html
*
* @param leftBody html to replace the contents of the body node
* @param leftCSS the CSS to use instead of the default
*/
public void setLeftBody(String leftBody, String leftCSS) {
this.leftBody = leftBody;
this.leftCss = leftCSS;
}
/** @exclude */
public String getLeftCss() {
return leftCss;
}
/** @exclude */