1
2
3
4
5
6
7
8
9
10
11
12 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;import java.awt.*;import java.awt.geom.*;
13
14
15
16
17
18
19
20 public class DialogItem
21 extends CommandMessage
22 {
23
24
25
26 public static final String PROTOTYPE =
27 " {Player text} {DialogId text} {Effect text} {Type text} {Id text} {Parent text} {Size null} {Position null} {Background text} {BgColor null} {Border null} {Text text} {TextColor null} {Action text} {Mode text} {Checked text} {NotChecked text} {Image text} {Origin null} {Scale null} ";
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 public DialogItem(
60 String Player, String DialogId, String Effect, String Type, String Id, String Parent, Dimension2D Size, Point2D Position, String Background, Color BgColor, Color Border, String Text, Color TextColor, String Action, String Mode, String Checked, String NotChecked, String Image, Point2D Origin, Dimension2D Scale
61 ) {
62
63 this.Player = Player;
64
65 this.DialogId = DialogId;
66
67 this.Effect = Effect;
68
69 this.Type = Type;
70
71 this.Id = Id;
72
73 this.Parent = Parent;
74
75 this.Size = Size;
76
77 this.Position = Position;
78
79 this.Background = Background;
80
81 this.BgColor = BgColor;
82
83 this.Border = Border;
84
85 this.Text = Text;
86
87 this.TextColor = TextColor;
88
89 this.Action = Action;
90
91 this.Mode = Mode;
92
93 this.Checked = Checked;
94
95 this.NotChecked = NotChecked;
96
97 this.Image = Image;
98
99 this.Origin = Origin;
100
101 this.Scale = Scale;
102
103 }
104
105
106
107
108
109
110
111
112
113
114
115
116 public DialogItem() {
117 }
118
119
120
121
122
123
124
125 public DialogItem(DialogItem original) {
126
127 this.Player = original.Player;
128
129 this.DialogId = original.DialogId;
130
131 this.Effect = original.Effect;
132
133 this.Type = original.Type;
134
135 this.Id = original.Id;
136
137 this.Parent = original.Parent;
138
139 this.Size = original.Size;
140
141 this.Position = original.Position;
142
143 this.Background = original.Background;
144
145 this.BgColor = original.BgColor;
146
147 this.Border = original.Border;
148
149 this.Text = original.Text;
150
151 this.TextColor = original.TextColor;
152
153 this.Action = original.Action;
154
155 this.Mode = original.Mode;
156
157 this.Checked = original.Checked;
158
159 this.NotChecked = original.NotChecked;
160
161 this.Image = original.Image;
162
163 this.Origin = original.Origin;
164
165 this.Scale = original.Scale;
166
167 }
168
169
170
171
172 protected
173 String Player =
174
175 null
176 ;
177
178
179
180
181
182
183 public String getPlayer()
184
185 {
186 return
187 Player;
188 }
189
190
191
192
193
194
195
196 public DialogItem
197 setPlayer(String Player)
198
199 {
200 this.Player = Player;
201 return this;
202 }
203
204
205
206
207 protected
208 String DialogId =
209
210 null
211 ;
212
213
214
215
216
217
218 public String getDialogId()
219
220 {
221 return
222 DialogId;
223 }
224
225
226
227
228
229
230
231 public DialogItem
232 setDialogId(String DialogId)
233
234 {
235 this.DialogId = DialogId;
236 return this;
237 }
238
239
240
241
242 protected
243 String Effect =
244 "ADD";
245
246
247
248
249
250
251 public String getEffect()
252
253 {
254 return
255 Effect;
256 }
257
258
259
260
261
262
263
264 public DialogItem
265 setEffect(String Effect)
266
267 {
268 this.Effect = Effect;
269 return this;
270 }
271
272
273
274
275 protected
276 String Type =
277
278 null
279 ;
280
281
282
283
284
285
286 public String getType()
287
288 {
289 return
290 Type;
291 }
292
293
294
295
296
297
298
299 public DialogItem
300 setType(String Type)
301
302 {
303 this.Type = Type;
304 return this;
305 }
306
307
308
309
310 protected
311 String Id =
312
313 null
314 ;
315
316
317
318
319
320
321 public String getId()
322
323 {
324 return
325 Id;
326 }
327
328
329
330
331
332
333
334 public DialogItem
335 setId(String Id)
336
337 {
338 this.Id = Id;
339 return this;
340 }
341
342
343
344
345 protected
346 String Parent =
347
348 null
349 ;
350
351
352
353
354
355
356 public String getParent()
357
358 {
359 return
360 Parent;
361 }
362
363
364
365
366
367
368
369 public DialogItem
370 setParent(String Parent)
371
372 {
373 this.Parent = Parent;
374 return this;
375 }
376
377
378
379
380 protected
381 Dimension2D Size =
382
383 null
384 ;
385
386
387
388
389
390
391 public Dimension2D getSize()
392
393 {
394 return
395 Size;
396 }
397
398
399
400
401
402
403
404 public DialogItem
405 setSize(Dimension2D Size)
406
407 {
408 this.Size = Size;
409 return this;
410 }
411
412
413
414
415 protected
416 Point2D Position =
417
418 null
419 ;
420
421
422
423
424
425
426 public Point2D getPosition()
427
428 {
429 return
430 Position;
431 }
432
433
434
435
436
437
438
439 public DialogItem
440 setPosition(Point2D Position)
441
442 {
443 this.Position = Position;
444 return this;
445 }
446
447
448
449
450 protected
451 String Background =
452
453 null
454 ;
455
456
457
458
459
460
461 public String getBackground()
462
463 {
464 return
465 Background;
466 }
467
468
469
470
471
472
473
474 public DialogItem
475 setBackground(String Background)
476
477 {
478 this.Background = Background;
479 return this;
480 }
481
482
483
484
485 protected
486 Color BgColor =
487
488 null
489 ;
490
491
492
493
494
495
496 public Color getBgColor()
497
498 {
499 return
500 BgColor;
501 }
502
503
504
505
506
507
508
509 public DialogItem
510 setBgColor(Color BgColor)
511
512 {
513 this.BgColor = BgColor;
514 return this;
515 }
516
517
518
519
520 protected
521 Color Border =
522
523 null
524 ;
525
526
527
528
529
530
531 public Color getBorder()
532
533 {
534 return
535 Border;
536 }
537
538
539
540
541
542
543
544 public DialogItem
545 setBorder(Color Border)
546
547 {
548 this.Border = Border;
549 return this;
550 }
551
552
553
554
555 protected
556 String Text =
557
558 null
559 ;
560
561
562
563
564
565
566 public String getText()
567
568 {
569 return
570 Text;
571 }
572
573
574
575
576
577
578
579 public DialogItem
580 setText(String Text)
581
582 {
583 this.Text = Text;
584 return this;
585 }
586
587
588
589
590 protected
591 Color TextColor =
592
593 null
594 ;
595
596
597
598
599
600
601 public Color getTextColor()
602
603 {
604 return
605 TextColor;
606 }
607
608
609
610
611
612
613
614 public DialogItem
615 setTextColor(Color TextColor)
616
617 {
618 this.TextColor = TextColor;
619 return this;
620 }
621
622
623
624
625 protected
626 String Action =
627
628 null
629 ;
630
631
632
633
634
635
636 public String getAction()
637
638 {
639 return
640 Action;
641 }
642
643
644
645
646
647
648
649 public DialogItem
650 setAction(String Action)
651
652 {
653 this.Action = Action;
654 return this;
655 }
656
657
658
659
660 protected
661 String Mode =
662
663 null
664 ;
665
666
667
668
669
670
671 public String getMode()
672
673 {
674 return
675 Mode;
676 }
677
678
679
680
681
682
683
684 public DialogItem
685 setMode(String Mode)
686
687 {
688 this.Mode = Mode;
689 return this;
690 }
691
692
693
694
695 protected
696 String Checked =
697
698 null
699 ;
700
701
702
703
704
705
706 public String getChecked()
707
708 {
709 return
710 Checked;
711 }
712
713
714
715
716
717
718
719 public DialogItem
720 setChecked(String Checked)
721
722 {
723 this.Checked = Checked;
724 return this;
725 }
726
727
728
729
730 protected
731 String NotChecked =
732
733 null
734 ;
735
736
737
738
739
740
741 public String getNotChecked()
742
743 {
744 return
745 NotChecked;
746 }
747
748
749
750
751
752
753
754 public DialogItem
755 setNotChecked(String NotChecked)
756
757 {
758 this.NotChecked = NotChecked;
759 return this;
760 }
761
762
763
764
765 protected
766 String Image =
767
768 null
769 ;
770
771
772
773
774
775
776 public String getImage()
777
778 {
779 return
780 Image;
781 }
782
783
784
785
786
787
788
789 public DialogItem
790 setImage(String Image)
791
792 {
793 this.Image = Image;
794 return this;
795 }
796
797
798
799
800 protected
801 Point2D Origin =
802
803 null
804 ;
805
806
807
808
809
810
811 public Point2D getOrigin()
812
813 {
814 return
815 Origin;
816 }
817
818
819
820
821
822
823
824 public DialogItem
825 setOrigin(Point2D Origin)
826
827 {
828 this.Origin = Origin;
829 return this;
830 }
831
832
833
834
835 protected
836 Dimension2D Scale =
837
838 null
839 ;
840
841
842
843
844
845
846 public Dimension2D getScale()
847
848 {
849 return
850 Scale;
851 }
852
853
854
855
856
857
858
859 public DialogItem
860 setScale(Dimension2D Scale)
861
862 {
863 this.Scale = Scale;
864 return this;
865 }
866
867 public String toString() {
868 return toMessage();
869 }
870
871 public String toHtmlString() {
872 return super.toString() + "[<br/>" +
873
874 "<b>Player</b> = " +
875 String.valueOf(getPlayer()
876 ) +
877 " <br/> " +
878
879 "<b>DialogId</b> = " +
880 String.valueOf(getDialogId()
881 ) +
882 " <br/> " +
883
884 "<b>Effect</b> = " +
885 String.valueOf(getEffect()
886 ) +
887 " <br/> " +
888
889 "<b>Type</b> = " +
890 String.valueOf(getType()
891 ) +
892 " <br/> " +
893
894 "<b>Id</b> = " +
895 String.valueOf(getId()
896 ) +
897 " <br/> " +
898
899 "<b>Parent</b> = " +
900 String.valueOf(getParent()
901 ) +
902 " <br/> " +
903
904 "<b>Size</b> = " +
905 String.valueOf(getSize()
906 ) +
907 " <br/> " +
908
909 "<b>Position</b> = " +
910 String.valueOf(getPosition()
911 ) +
912 " <br/> " +
913
914 "<b>Background</b> = " +
915 String.valueOf(getBackground()
916 ) +
917 " <br/> " +
918
919 "<b>BgColor</b> = " +
920 String.valueOf(getBgColor()
921 ) +
922 " <br/> " +
923
924 "<b>Border</b> = " +
925 String.valueOf(getBorder()
926 ) +
927 " <br/> " +
928
929 "<b>Text</b> = " +
930 String.valueOf(getText()
931 ) +
932 " <br/> " +
933
934 "<b>TextColor</b> = " +
935 String.valueOf(getTextColor()
936 ) +
937 " <br/> " +
938
939 "<b>Action</b> = " +
940 String.valueOf(getAction()
941 ) +
942 " <br/> " +
943
944 "<b>Mode</b> = " +
945 String.valueOf(getMode()
946 ) +
947 " <br/> " +
948
949 "<b>Checked</b> = " +
950 String.valueOf(getChecked()
951 ) +
952 " <br/> " +
953
954 "<b>NotChecked</b> = " +
955 String.valueOf(getNotChecked()
956 ) +
957 " <br/> " +
958
959 "<b>Image</b> = " +
960 String.valueOf(getImage()
961 ) +
962 " <br/> " +
963
964 "<b>Origin</b> = " +
965 String.valueOf(getOrigin()
966 ) +
967 " <br/> " +
968
969 "<b>Scale</b> = " +
970 String.valueOf(getScale()
971 ) +
972 " <br/> " +
973
974 "<br/>]"
975 ;
976 }
977
978 public String toMessage() {
979 StringBuffer buf = new StringBuffer();
980 buf.append("DLGITEM");
981
982 if (Player != null) {
983 buf.append(" {Player " + Player + "}");
984 }
985
986 if (DialogId != null) {
987 buf.append(" {DialogId " + DialogId + "}");
988 }
989
990 if (Effect != null) {
991 buf.append(" {Effect " + Effect + "}");
992 }
993
994 if (Type != null) {
995 buf.append(" {Type " + Type + "}");
996 }
997
998 if (Id != null) {
999 buf.append(" {Id " + Id + "}");
1000 }
1001
1002 if (Parent != null) {
1003 buf.append(" {Parent " + Parent + "}");
1004 }
1005
1006 if (Size != null) {
1007 buf.append(" {Size " +
1008 Size.getWidth() + "," +
1009 Size.getHeight() + "}");
1010 }
1011
1012 if (Position != null) {
1013 buf.append(" {Position " +
1014 Position.getX() + "," +
1015 Position.getY() + "}");
1016 }
1017
1018 if (Background != null) {
1019 buf.append(" {Background " + Background + "}");
1020 }
1021
1022 if (BgColor != null) {
1023 buf.append(" {BgColor " +
1024 BgColor.getRed() + "," +
1025 BgColor.getGreen() + "," +
1026 BgColor.getBlue() + "," +
1027 BgColor.getAlpha() + "}");
1028 }
1029
1030 if (Border != null) {
1031 buf.append(" {Border " +
1032 Border.getRed() + "," +
1033 Border.getGreen() + "," +
1034 Border.getBlue() + "," +
1035 Border.getAlpha() + "}");
1036 }
1037
1038 if (Text != null) {
1039 buf.append(" {Text " + Text + "}");
1040 }
1041
1042 if (TextColor != null) {
1043 buf.append(" {TextColor " +
1044 TextColor.getRed() + "," +
1045 TextColor.getGreen() + "," +
1046 TextColor.getBlue() + "," +
1047 TextColor.getAlpha() + "}");
1048 }
1049
1050 if (Action != null) {
1051 buf.append(" {Action " + Action + "}");
1052 }
1053
1054 if (Mode != null) {
1055 buf.append(" {Mode " + Mode + "}");
1056 }
1057
1058 if (Checked != null) {
1059 buf.append(" {Checked " + Checked + "}");
1060 }
1061
1062 if (NotChecked != null) {
1063 buf.append(" {NotChecked " + NotChecked + "}");
1064 }
1065
1066 if (Image != null) {
1067 buf.append(" {Image " + Image + "}");
1068 }
1069
1070 if (Origin != null) {
1071 buf.append(" {Origin " +
1072 Origin.getX() + "," +
1073 Origin.getY() + "}");
1074 }
1075
1076 if (Scale != null) {
1077 buf.append(" {Scale " +
1078 Scale.getWidth() + "," +
1079 Scale.getHeight() + "}");
1080 }
1081
1082 return buf.toString();
1083 }
1084
1085
1086
1087
1088
1089
1090
1091
1092 }
1093