aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java
blob: bd70484ccf4d53649d30618b250a4822971a7d34 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package net.java.sip.communicator.impl.gui.utils;

import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import java.util.*;

import javax.imageio.*;
import javax.imageio.stream.*;

import net.java.sip.communicator.util.*;

/**
 * Stores and loads images used throughout this ui implementation.
 *
 * @author Yana Stamcheva
 */
public class ImageLoader {

    private static Logger log = Logger.getLogger(ImageLoader.class);

    /**
     * Stores all already loaded images.
     */
    private static Hashtable loadedImages = new Hashtable();

    /*------------------------------------------------------------------------
     * =========================LOOK AND FEEL IMAGES==========================
     * -----------------------------------------------------------------------
     */
    /**
     * The background image of a button.
     */
    public static final ImageID BUTTON = new ImageID("BUTTON");

    /**
     * The rollover image of a button.
     */
    public static final ImageID BUTTON_ROLLOVER
        = new ImageID("BUTTON_ROLLOVER");

    /**
     * The image used for a horizontal split.
     */
    public static final ImageID SPLITPANE_HORIZONTAL
        = new ImageID("SPLITPANE_HORIZONTAL");

    /**
     * The image used for a vertical split.
     */
    public static final ImageID SPLITPANE_VERTICAL
        = new ImageID("SPLITPANE_VERTICAL");

    /**
     * The image used for the "thumb" of a vertical scrollbar.
     */
    public static final ImageID SCROLLBAR_THUMB_VERTICAL
        = new ImageID("SCROLLBAR_VERTICAL");

    /**
     * The image used for the "thumb" of a horizontal scrollbar.
     */
    public static final ImageID SCROLLBAR_THUMB_HORIZONTAL
        = new ImageID("SCROLLBAR_HORIZONTAL");

    /**
     * The image used for the "thumb handle" of a horizontal scrollbar.
     */
    public static final ImageID SCROLLBAR_THUMB_HANDLE_HORIZONTAL
        = new ImageID("SCROLLBAR_THUMB_HORIZONTAL");

    /**
     * The image used for the "thumb handle" of a vertical scrollbar.
     */
    public static final ImageID SCROLLBAR_THUMB_HANDLE_VERTICAL
        = new ImageID("SCROLLBAR_THUMB_VERTICAL");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint the background
     * of a tab.
     */
    public static final ImageID TAB_BG = new ImageID("TAB_BG");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint the background
     * of a selected tab.
     */
    public static final ImageID SELECTED_TAB_BG
        = new ImageID("SELECTED_TAB_BG");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint the background
     * of a closable tab.
     */
    public static final ImageID CLOSABLE_TAB_BG
        = new ImageID("CLOSABLE_TAB_BG");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint the background
     * of a closable selected tab.
     */
    public static final ImageID SELECTED_CLOSABLE_TAB_BG
        = new ImageID("SELECTED_CLOSABLE_TAB_BG");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint a close
     * button on a tab.
     */
    public static final ImageID CLOSE_TAB_ICON = new ImageID("CLOSE_TAB_ICON");

    /**
     * The image used in the <tt>SIPCommLookAndFeel</tt> to paint a rollover
     * close button on a tab.
     */
    public static final ImageID CLOSE_TAB_SELECTED_ICON
        = new ImageID("CLOSE_TAB_SELECTED_ICON");

    /////////////////////// OptionPane icons /////////////////////////////

    /**
     * The icon used in the <tt>SIPCommLookAndFeel</tt> to paint the icon
     * of an option pane warning message.
     */
    public static final ImageID WARNING_ICON = new ImageID("WARNING_ICON");
    
    /**
     * The icon used in the <tt>SIPCommLookAndFeel</tt> to paint the icon
     * of an option pane error message.
     */
    public static final ImageID ERROR_ICON = new ImageID("ERROR_ICON");
    
    /**
     * The icon used in the <tt>SIPCommLookAndFeel</tt> to paint the icon
     * of an option pane info message.
     */
    public static final ImageID INFO_ICON = new ImageID("INFO_ICON");

    /*------------------------------------------------------------------------
     * ============================APPLICATION ICONS =========================
     * -----------------------------------------------------------------------
     */
    /**
     * An empty 16x16 icon used for alignment.
     */
    public static final ImageID EMPTY_16x16_ICON
        = new ImageID("EMPTY_16x16_ICON");

    /**
     * The icon on the "Add contact" button in the <tt>QuickMenu</tt>.
     */
    public static final ImageID QUICK_MENU_ADD_ICON
        = new ImageID("QUICK_MENU_ADD_ICON");

    /**
     * The icon on the "Configure" button in the <tt>QuickMenu</tt>.
     */
    public static final ImageID QUICK_MENU_CONFIGURE_ICON
        = new ImageID("QUICK_MENU_CONFIGURE_ICON");

    /**
     * The icon on the "Hide/Show offline contacts" button in the
     * <tt>QuickMenu</tt>.
     */
    public static final ImageID QUICK_MENU_SHOW_OFFLINE_ICON
        = new ImageID("QUICK_MENU_SHOW_OFFLINE_ICON");

    /**
     * The icon on the "Info" button in the <tt>QuickMenu</tt>.
     */
    public static final ImageID QUICK_MENU_INFO_ICON
        = new ImageID("QUICK_MENU_INFO_ICON");

    /**
     * The background image of a <tt>QuickMenu</tt> button.
     */
    public static final ImageID QUICK_MENU_BUTTON_BG
        = new ImageID("QUICK_MENU_BUTTON_BG");

    /**
     * The background rollover image of a <tt>QuickMenu</tt> button.
     */
    public static final ImageID QUICK_MENU_BUTTON_ROLLOVER_BG
        = new ImageID("QUICK_MENU_BUTTON_ROLLOVER_BG");

    /**
     * The call button image.
     */
    public static final ImageID CALL_BUTTON_BG
        = new ImageID("CALL_BUTTON_BG");

    /**
     * The hangup button image.
     */
    public static final ImageID HANGUP_BUTTON_BG
        = new ImageID("HANGUP_BUTTON_BG");

    /**
     * The call button mouse over image.
     */
    public static final ImageID CALL_ROLLOVER_BUTTON_BG
        = new ImageID("CALL_ROLLOVER_BUTTON_BG");

    /**
     * The hangup button mouse over image.
     */
    public static final ImageID HANGUP_ROLLOVER_BUTTON_BG
        = new ImageID("HANGUP_ROLLOVER_BUTTON_BG");

    /**
     * The hangup button pressed image.
     */
    public static final ImageID CALL_BUTTON_PRESSED_BG
        = new ImageID("CALL_BUTTON_PRESSED_BG");

    /**
     * The hangup button pressed image.
     */
    public static final ImageID HANGUP_BUTTON_PRESSED_BG
        = new ImageID("HANGUP_BUTTON_PRESSED_BG");

    /**
     * The background image for the <tt>StatusSelectorBox</tt>.
     */
    public static final ImageID STATUS_SELECTOR_BOX
        = new ImageID("STATUS_SELECTOR_BOX");

    /**
     * A dial button icon.
     */
    public static final ImageID ONE_DIAL_BUTTON
        = new ImageID("ONE_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID TWO_DIAL_BUTTON
        = new ImageID("TWO_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID THREE_DIAL_BUTTON
        = new ImageID("THREE_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID FOUR_DIAL_BUTTON
        = new ImageID("FOUR_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID FIVE_DIAL_BUTTON
        = new ImageID("FIVE_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID SIX_DIAL_BUTTON
        = new ImageID("SIX_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID SEVEN_DIAL_BUTTON
        = new ImageID("SEVEN_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID EIGHT_DIAL_BUTTON
        = new ImageID("EIGHT_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID NINE_DIAL_BUTTON
        = new ImageID("NINE_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID STAR_DIAL_BUTTON
        = new ImageID("STAR_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID ZERO_DIAL_BUTTON
        = new ImageID("ZERO_DIAL_BUTTON");

    /**
     * A dial button icon.
     */
    public static final ImageID DIEZ_DIAL_BUTTON
        = new ImageID("DIEZ_DIAL_BUTTON");

    /**
     * The image used, when a contact has no photo specified.
     */
    public static final ImageID DEFAULT_USER_PHOTO
        = new ImageID("DEFAULT_USER_PHOTO");

    /**
     * The image used in the chat window, when a contact has no photo
     * specified.
     */
    public static final ImageID DEFAULT_CHAT_USER_PHOTO
        = new ImageID("DEFAULT_CHAT_USER_PHOTO");

    /**
     * The minimize button icon in the <tt>CallPanel</tt>.
     */
    public static final ImageID CALL_PANEL_MINIMIZE_BUTTON
        = new ImageID("CALL_PANEL_MINIMIZE_BUTTON");

    /**
     * The restore button icon in the <tt>CallPanel</tt>.
     */
    public static final ImageID CALL_PANEL_RESTORE_BUTTON
        = new ImageID("CALL_PANEL_RESTORE_BUTTON");

    /**
     * The minimize rollover button icon in the <tt>CallPanel</tt>.
     */
    public static final ImageID CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON
        = new ImageID("CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON");

    /**
     * The restore rollover button icon in the <tt>CallPanel</tt>.
     */
    public static final ImageID CALL_PANEL_RESTORE_ROLLOVER_BUTTON
        = new ImageID("CALL_PANEL_RESTORE_ROLLOVER_BUTTON");

    /**
     * The background image of the "Add contact to chat" button in the
     * chat window.
     */
    public static final ImageID ADD_TO_CHAT_BUTTON
        = new ImageID("ADD_TO_CHAT_BUTTON");

    /**
     * The background rollover image of the "Add contact to chat" button in
     * the chat window.
     */
    public static final ImageID ADD_TO_CHAT_ROLLOVER_BUTTON
        = new ImageID("ADD_TO_CHAT_ROLLOVER_BUTTON");

    /**
     * The icon image of the "Add contact to chat" button in the
     * chat window.
     */
    public static final ImageID ADD_TO_CHAT_ICON
        = new ImageID("ADD_TO_CHAT_ICON");

    /**
     * The image used as a separator in all toolbars.
     */
    public static final ImageID TOOLBAR_DIVIDER
        = new ImageID("TOOLBAR_DIVIDER");

    /**
     * The image used for decoration of the "Add contact" window.
     */
    public static final ImageID ADD_CONTACT_WIZARD_ICON
        = new ImageID("ADD_CONTACT_WIZARD_ICON");

    /**
     * The image used for decoration of the "Add group" window.
     */
    public static final ImageID ADD_GROUP_ICON
        = new ImageID("ADD_GROUP_ICON");

    /**
     * The image used for decoration of the "Rename contact" window.
     */
    public static final ImageID RENAME_DIALOG_ICON
        = new ImageID("RENAME_DIALOG_ICON");

    /**
     * The image used for decoration of the "Open in browser" item in
     * the right button click menu in chat window.
     */
    public static final ImageID BROWSER_ICON
        = new ImageID("BROWSER_ICON");

    /**
     * The image used for decoration of all windows concerning the process of
     * authorization.
     */
    public static final ImageID AUTHORIZATION_ICON
        = new ImageID("AUTHORIZATION_ICON");

    /**
     * The image used for decoration of incoming calls in the call list panel.
     */
    public static final ImageID INCOMING_CALL_ICON
        = new ImageID("INCOMING_CALL");

    /**
     * The image used for decoration of outgoing calls in the call list panel.
     */
    public static final ImageID OUTGOING_CALL_ICON
        = new ImageID("OUTGOING_CALL");

    /**
     * The image used in the right button menu for the move contact item.
     */
    public static final ImageID MOVE_CONTACT_ICON
        = new ImageID("MOVE_CONTACT");

    /**
     * The image used for error messages in the chat window.
     */
    public static final ImageID EXCLAMATION_MARK
        = new ImageID("EXCLAMATION_MARK");

    /**
     * The image used for about window background.
     */
    public static final ImageID ABOUT_WINDOW_BACKGROUND
        = new ImageID("ABOUT_WINDOW_BACKGROUND");
    
    /**
     * The image used for opened groups.
     */
    public static final ImageID OPENED_GROUP
        = new ImageID("OPENED_GROUP");
    
    /**
     * The image used for closed groups.
     */
    public static final ImageID CLOSED_GROUP
        = new ImageID("CLOSED_GROUP");
    
    // ///////////////////// Edit Text Toolbar icons //////////////////////////

    /**
     * "Left align" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_LEFT_BUTTON
        = new ImageID("ALIGN_LEFT_BUTTON");

    /**
     * "Right align" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_RIGHT_BUTTON
        = new ImageID("ALIGN_RIGHT_BUTTON");

    /**
     * "Center align" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_CENTER_BUTTON
        = new ImageID("ALIGN_RIGHT_BUTTON");

    /**
     * "Left align" button rollover image in the <tt>EditTextToolBar</tt> in
     * the <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_LEFT_ROLLOVER_BUTTON
        = new ImageID("ALIGN_LEFT_ROLLOVER_BUTTON");

    /**
     * "Right align" button rollover image in the <tt>EditTextToolBar</tt> in
     * the <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_RIGHT_ROLLOVER_BUTTON
        = new ImageID("ALIGN_RIGHT_ROLLOVER_BUTTON");

    /**
     * "Center align" button rollover image in the <tt>EditTextToolBar</tt> in
     * the <tt>ChatWindow</tt>.
     */
    public static final ImageID ALIGN_CENTER_ROLLOVER_BUTTON
        = new ImageID("ALIGN_CENTER_ROLLOVER_BUTTON");

    /**
     * "Bold" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_BOLD_BUTTON
        = new ImageID("TEXT_BOLD_BUTTON");

    /**
     * "Italic" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_ITALIC_BUTTON
        = new ImageID("TEXT_ITALIC_BUTTON");

    /**
     * "Underline" button image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_UNDERLINED_BUTTON
        = new ImageID("TEXT_UNDERLINED_BUTTON");

    /**
     * "Bold" button rollover image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_BOLD_ROLLOVER_BUTTON
        = new ImageID("TEXT_BOLD_ROLLOVER_BUTTON");

    /**
     * "Italic" button rollover image in the <tt>EditTextToolBar</tt> in the
     * <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_ITALIC_ROLLOVER_BUTTON
        = new ImageID("TEXT_ITALIC_ROLLOVER_BUTTON");

    /**
     * "Underline" button rollover image in the <tt>EditTextToolBar</tt> in
     * the <tt>ChatWindow</tt>.
     */
    public static final ImageID TEXT_UNDERLINED_ROLLOVER_BUTTON
        = new ImageID("TEXT_UNDERLINED_ROLLOVER_BUTTON");

    // ///////////////////////// Main Toolbar icons ////////////////////////////

    /**
     * The background image of a button in one of the <tt>ChatWindow</tt>
     * toolbars.
     */
    public static final ImageID CHAT_TOOLBAR_BUTTON_BG
        = new ImageID("MSG_TOOLBAR_BUTTON_BG");

    /**
     * The background rollover image of a button in one of the
     * <tt>ChatWindow</tt> toolbars.
     */
    public static final ImageID CHAT_TOOLBAR_ROLLOVER_BUTTON_BG
        = new ImageID("MSG_TOOLBAR_ROLLOVER_BUTTON_BG");

    /**
     * Copy icon.
     */
    public static final ImageID COPY_ICON = new ImageID("COPY_ICON");

    /**
     * Cut icon.
     */
    public static final ImageID CUT_ICON = new ImageID("CUT_ICON");

    /**
     * Paste icon.
     */
    public static final ImageID PASTE_ICON = new ImageID("PASTE_ICON");

    /**
     * Smiley icon, used for the "Smiley" button in the <tt>MainToolBar</tt>.
     */
    public static final ImageID SMILIES_ICON = new ImageID("SMILIES_ICON");

    /**
     * Save icon.
     */
    public static final ImageID SAVE_ICON = new ImageID("SAVE_ICON");

    /**
     * Print icon.
     */
    public static final ImageID PRINT_ICON = new ImageID("PRINT_ICON");

    /**
     * Close icon.
     */
    public static final ImageID CLOSE_ICON = new ImageID("CLOSE_ICON");

    /**
     * Quit icon.
     */
    public static final ImageID QUIT_ICON = new ImageID("QUIT_ICON");

    /**
     * Left flash icon.
     */
    public static final ImageID PREVIOUS_ICON = new ImageID("PREVIOUS_ICON");

    /**
     * Right flash icon.
     */
    public static final ImageID NEXT_ICON = new ImageID("NEXT_ICON");

    /**
     * Clock icon.
     */
    public static final ImageID HISTORY_ICON = new ImageID("HISTORY_ICON");

    /**
     * Send file icon.
     */
    public static final ImageID SEND_FILE_ICON = new ImageID("SEND_FILE_ICON");

    /**
     * Font icon.
     */
    public static final ImageID FONT_ICON = new ImageID("FONT_ICON");

    // ///////////////////// Chat contact icons ////////////////////////////////

    /**
     * A special "info" icon used in the <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_CONTACT_INFO_BUTTON
        = new ImageID("CHAT_CONTACT_INFO_BUTTON");

    /**
     * A special "info" rollover icon used in the <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_CONTACT_INFO_ROLLOVER_BUTTON
        = new ImageID("CHAT_CONTACT_INFO_ROLLOVER_BUTTON");

    /**
     * A special "call" icon used in the <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_CONTACT_CALL_BUTTON
        = new ImageID("CHAT_CONTACT_CALL_BUTTON");

    /**
     * A special "call" rollover icon used in the <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_CONTACT_CALL_ROLLOVER_BUTTON
        = new ImageID("CHAT_CONTACT_CALL_ROLLOVER_BUTTON");

    /**
     * A special "send file" icon used in the <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_CONTACT_SEND_FILE_BUTTON
        = new ImageID("CHAT_CONTACT_SEND_FILE_BUTTON");

    /**
     * A special "send file" rollover icon used in the
     * <tt>ChatContactPanel</tt>.
     */
    public static final ImageID CHAT_SEND_FILE_ROLLOVER_BUTTON
        = new ImageID("CHAT_SEND_FILE_ROLLOVER_BUTTON");


    ////////////////////////////// 16x16 icons ////////////////////////////////
    /**
     * Send message 16x16 image.
     */
    public static final ImageID SEND_MESSAGE_16x16_ICON
        = new ImageID("SEND_MESSAGE_16x16_ICON");

    /**
     * Delete 16x16 image.
     */
    public static final ImageID DELETE_16x16_ICON
        = new ImageID("DELETE_16x16_ICON");

    /**
     * History 16x16 image.
     */
    public static final ImageID HISTORY_16x16_ICON
        = new ImageID("HISTORY_16x16_ICON");

    /**
     * Send file 16x16 image.
     */
    public static final ImageID SEND_FILE_16x16_ICON
        = new ImageID("SEND_FILE_16x16_ICON");

    /**
     * Groups 16x16 image.
     */
    public static final ImageID GROUPS_16x16_ICON
        = new ImageID("GROUPS_16x16_ICON");

    /**
     * Info 16x16 image.
     */
    public static final ImageID INFO_16x16_ICON
        = new ImageID("INFO_16x16_ICON");

    /**
     * Add contact 16x16 image.
     */
    public static final ImageID ADD_CONTACT_16x16_ICON
        = new ImageID("ADD_CONTACT_16x16_ICON");

    /**
     * Add contact 16x16 image.
     */
    public static final ImageID ADD_GROUP_16x16_ICON
        = new ImageID("ADD_GROUP_16x16_ICON");

    /**
     * Rename 16x16 image.
     */
    public static final ImageID RENAME_16x16_ICON
        = new ImageID("RENAME_16x16_ICON");

    /**
     * Remove 16x16 image.
     */
    public static final ImageID REMOVE_16x16_ICON
        = new ImageID("REMOVE_16x16_ICON");

    ///////////////////////////////////////////////////////////////////////////

    /**
     * Contact list cell "more info" button.
     */
    public static final ImageID MORE_INFO_ICON = new ImageID("MORE_INFO_ICON");

    /**
     * Toolbar drag area icon.
     */
    public static final ImageID TOOLBAR_DRAG_ICON = new ImageID(
            "TOOLBAR_DRAG_ICON");

    /**
     * The background image of <tt>LoginWindow</tt> and <tt>WelcomeWindow</tt>
     * frames.
     */
    public static final ImageID LOGIN_WINDOW_LOGO = new ImageID(
            "LOGIN_WINDOW_LOGO");

    /**
     * The background image of the <tt>AuthenticationWindow</tt>.
     */
    public static final ImageID AUTH_WINDOW_BACKGROUND = new ImageID(
            "AUTH_WINDOW_BACKGROUND");

    /**
     * The icon used to indicate a search.
     */
    public static final ImageID SEARCH_ICON = new ImageID("SEARCH_ICON");

    /*
     * =========================================================================
     * --------------------- PROTOCOLS STATUS ICONS ---------------------------
     * ========================================================================
     */
    /**
     * The SIP Communicator logo 16x16 icon.
     */
    public static final ImageID SIP_COMMUNICATOR_LOGO
        = new ImageID("SIP_COMMUNICATOR_LOGO");

    /**
     * The ICQ logo 32x32 icon.
     */
    public static final ImageID ICQ_32x32 = new ImageID("ICQ_32x32");

    /**
     * The ICQ logo 16x16 icon.
     */
    public static final ImageID ICQ_LOGO = new ImageID("ICQ_LOGO");

    /**
     * The ICQ "connecting" 16x16 animated icon.
     */
    public static final ImageID ICQ_CONNECTING = new ImageID("ICQ_CONNECTING");

    /**
     * The MSN logo 32x32 icon.
     */
    public static final ImageID MSN_32x32 = new ImageID("MSN_32x32");

    /**
     * The MSN logo 16x16 icon.
     */
    public static final ImageID MSN_LOGO = new ImageID("MSN_LOGO");

    /**
     * The MSN "connecting" 16x16 animated icon.
     */
    public static final ImageID MSN_CONNECTING = new ImageID("MSN_CONNECTING");

    /**
     * The AIM logo 32x32 icon.
     */
    public static final ImageID AIM_32x32 = new ImageID("AIM_32x32");


    /**
     * The AIM logo 16x16 icon.
     */
    public static final ImageID AIM_LOGO = new ImageID("AIM_LOGO");

    /**
     * The Yahoo logo 32x32 icon.
     */
    public static final ImageID YAHOO_32x32 = new ImageID("YAHOO_32x32");

    /**
     * The Yahoo logo 16x16 icon.
     */
    public static final ImageID YAHOO_LOGO = new ImageID("YAHOO_LOGO");
    
    /**
     * The ICQ "connecting" 16x16 animated icon.
     */
    public static final ImageID YAHOO_CONNECTING = new ImageID("YAHOO_CONNECTING");

    /**
     * The Jabber logo 32x32 icon.
     */
    public static final ImageID JABBER_32x32 = new ImageID("JABBER_32x32");

    /**
     * The JABBER "connecting" 16x16 animated icon.
     */
    public static final ImageID JABBER_CONNECTING = new ImageID("JABBER_CONNECTING");


    /**
     * The Jabber logo 16x16 icon.
     */
    public static final ImageID JABBER_LOGO = new ImageID("JABBER_LOGO");

    /**
     * The Skype logo 32x32 icon.
     */
    public static final ImageID SKYPE_32x32 = new ImageID("SKYPE_32x32");

    /**
     * The Skype logo 16x16 icon.
     */
    public static final ImageID SKYPE_LOGO = new ImageID("SKYPE_LOGO");

    /**
     * The SIP logo 16x16 icon.
     */
    public static final ImageID SIP_LOGO = new ImageID("SIP_LOGO");

    /**
     * The SIP logo 32x32 icon.
     */
    public static final ImageID SIP_32x32 = new ImageID("SIP_32x32");

    
    /**
     * The SIP "connecting" 16x16 animated icon.
     */
    public static final ImageID SIP_CONNECTING = new ImageID("SIP_CONNECTING");

    
    /*
     * =======================================================================
     * ------------------------ USERS' ICONS ---------------------------------
     * =======================================================================
     */

    /**
     * Contact "online" icon.
     */
    public static final ImageID USER_ONLINE_ICON = new ImageID(
            "USER_ONLINE_ICON");

    /**
     * Contact "offline" icon.
     */
    public static final ImageID USER_OFFLINE_ICON = new ImageID(
            "USER_OFFLINE_ICON");

    /**
     * Contact "away" icon.
     */
    public static final ImageID USER_AWAY_ICON = new ImageID("USER_AWAY_ICON");

    /**
     * Contact "not available" icon.
     */
    public static final ImageID USER_NA_ICON = new ImageID("USER_NA_ICON");

    /**
     * Contact "free for chat" icon.
     */
    public static final ImageID USER_FFC_ICON = new ImageID("USER_FFC_ICON");

    /**
     * Contact "do not disturb" icon.
     */
    public static final ImageID USER_DND_ICON = new ImageID("USER_DND_ICON");

    /**
     * Contact "occupied" icon.
     */
    public static final ImageID USER_OCCUPIED_ICON = new ImageID(
            "USER_OCCUPIED_ICON");

    /*
     * =====================================================================
     * ---------------------------- SMILIES --------------------------------
     * =====================================================================
     */

    public static final ImageID SMILEY1 = new ImageID("SMILEY1");

    public static final ImageID SMILEY2 = new ImageID("SMILEY2");

    public static final ImageID SMILEY3 = new ImageID("SMILEY3");

    public static final ImageID SMILEY4 = new ImageID("SMILEY4");

    public static final ImageID SMILEY5 = new ImageID("SMILEY5");

    public static final ImageID SMILEY6 = new ImageID("SMILEY6");

    public static final ImageID SMILEY7 = new ImageID("SMILEY7");

    public static final ImageID SMILEY8 = new ImageID("SMILEY8");

    public static final ImageID SMILEY9 = new ImageID("SMILEY9");

    public static final ImageID SMILEY10 = new ImageID("SMILEY10");

    public static final ImageID SMILEY11 = new ImageID("SMILEY11");

    public static final ImageID SMILEY12 = new ImageID("SMILEY12");

    /**
     * Load default smilies pack.
     *
     * @return the ArrayList of all smilies.
     */
    public static ArrayList getDefaultSmiliesPack() {

        ArrayList defaultPackList = new ArrayList();

        defaultPackList.add(new Smiley(ImageLoader.SMILEY1, new String[] {
                "$-)", "$)" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY2, new String[] {
                "B-)", "B)" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY3, new String[] {
                ":-*", ":*" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY4, new String[] {
                ":-0" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY5, new String[] {
                ":-((", ":((" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY6, new String[] {
                ":-~", ":~" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY7, new String[] {
                ":-|", ":|" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY8, new String[] {
                ":-P", ":P", ":-p", ":p" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY9, new String[] {
                ":-))", ":))" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY10, new String[] {
                ":-(", ":(" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY11, new String[] {
                ":-)", ":)" }));

        defaultPackList.add(new Smiley(ImageLoader.SMILEY12, new String[] {
                ";-)", ";)" }));

        return defaultPackList;
    }

    /**
     * Returns a Smiley object for a given smiley string.
     * @param smileyString One of :-), ;-), etc.
     * @return A Smiley object for a given smiley string.
     */
    public static Smiley getSmiley(String smileyString) {
        ArrayList smiliesList = getDefaultSmiliesPack();

        for (int i = 0; i < smiliesList.size(); i++) {

            Smiley smiley = (Smiley) smiliesList.get(i);

            String[] smileyStrings = smiley.getSmileyStrings();

            for (int j = 0; j < smileyStrings.length; j++) {

                String srcString = smileyStrings[j];

                if (srcString.equals(smileyString))
                    return smiley;
            }
        }
        return null;
    }

    /**
     * Loads an image from a given image identifier.
     * @param imageID The identifier of the image.
     * @return The image for the given identifier.
     */
    public static BufferedImage getImage(ImageID imageID) {
        BufferedImage image = null;

        if (loadedImages.containsKey(imageID)) {

            image = (BufferedImage) loadedImages.get(imageID);
        } else {
            String path = Images.getString(imageID.getId());

            try {
                image = ImageIO.read(ImageLoader.class.getClassLoader()
                        .getResource(path));

                loadedImages.put(imageID, image);

            } catch (IOException e) {
                log.error("Failed to load image:" + path, e);
            }
        }

        return image;
    }

    /**
     * Loads an image from a given image identifier.
     * @param imageID The identifier of the image.
     * @return The image for the given identifier.
     */
    public static byte[] getImageInBytes(ImageID imageID) {
        byte[] image = new byte[100000];

        String path = Images.getString(imageID.getId());
        try {
            Images.class.getClassLoader()
                    .getResourceAsStream(path).read(image);

        } catch (IOException e) {
            log.error("Failed to load image:" + path, e);
        }

        return image;
    }

    /**
     * Loads an image from a given bytes array.
     * @param imageBytes The bytes array to load the image from.
     * @return The image for the given bytes array.
     */
    public static Image getBytesInImage(byte[] imageBytes) {

        Image image = null;
        try {
            image = ImageIO.read(
                    new ByteArrayInputStream(imageBytes));
        }
        catch (IOException e) {
            log.error("Failed to convert bytes to image", e);
        }
        return image;
    }

    /**
     * Loads an animated gif image.
     * @param imageID The image identifier.
     * @return A BufferedImage array containing the animated image.
     */
    public static BufferedImage[] getAnimatedImage(ImageID imageID) {

        String path = Images.getString(imageID.getId());

        URL url = ImageLoader.class.getClassLoader().getResource(path);

        Iterator readers = ImageIO.getImageReadersBySuffix("gif");

        ImageReader reader = (ImageReader) readers.next();

        ImageInputStream iis;

        BufferedImage[] images = null;

        try {
            iis = ImageIO.createImageInputStream(url.openStream());

            reader.setInput(iis);

            final int numImages;

            numImages = reader.getNumImages(true);

            images = new BufferedImage[numImages];

            for (int i = 0; i < numImages; ++i) {
                images[i] = reader.read(i);
            }

        } catch (IOException e) {
            log.error("Failed to load image:" + path, e);
        } finally {
            log.logExit();
        }
        return images;
    }

    /**
     * Represents the Image Identifier.
     */
    public static class ImageID {
        private String id;

        private ImageID(String id) {
            this.id = id;
        }

        public String getId() {
            return id;
        }
    }

    /**
     * Returns the path string of an already loaded image, otherwise null.
     *
     * @param image
     *            The image wich path to return.
     * @return The path string of an already loaded image, otherwise null.
     */
    public static String getImagePath(Image image) {

        String path = null;

        Iterator i = ImageLoader.loadedImages.entrySet().iterator();

        while (i.hasNext()) {
            Map.Entry entry = (Map.Entry) i.next();

            if (entry.getValue().equals(image)) {
                String imageID = ((ImageID) entry.getKey()).getId();

                path = Images.getString(imageID);
            }
        }

        return path;
    }
}