-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponent.java
More file actions
6020 lines (5588 loc) · 178 KB
/
Component.java
File metadata and controls
6020 lines (5588 loc) · 178 KB
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
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package java.awt;
//import java.awt.dnd.DropTarget;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.HierarchyBoundsListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.im.InputContext;
import java.awt.im.InputMethodRequests;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.awt.peer.ComponentPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EventListener;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
//???AWT
//import javax.accessibility.Accessible;
//import javax.accessibility.AccessibleComponent;
//import javax.accessibility.AccessibleContext;
//import javax.accessibility.AccessibleRole;
//import javax.accessibility.AccessibleState;
//import javax.accessibility.AccessibleStateSet;
import org.apache.harmony.awt.ClipRegion; //import org.apache.harmony.awt.FieldsAccessor;
import org.apache.harmony.awt.gl.MultiRectArea;
import org.apache.harmony.awt.internal.nls.Messages;
import org.apache.harmony.awt.state.State; //import org.apache.harmony.awt.text.TextFieldKit;
//import org.apache.harmony.awt.text.TextKit;
import org.apache.harmony.awt.wtk.NativeWindow;
import org.apache.harmony.luni.util.NotImplementedException;
/**
* The abstract Component class specifies an object with a graphical
* representation that can be displayed on the screen and that can interact with
* the user (for example: scrollbars, buttons, checkboxes).
*
* @since Android 1.0
*/
public abstract class Component implements ImageObserver, MenuContainer, Serializable {
/**
* The Constant serialVersionUID.
*/
private static final long serialVersionUID = -7644114512714619750L;
/**
* The Constant TOP_ALIGNMENT indicates the top alignment of the component.
*/
public static final float TOP_ALIGNMENT = 0.0f;
/**
* The Constant CENTER_ALIGNMENT indicates the center alignment of the
* component.
*/
public static final float CENTER_ALIGNMENT = 0.5f;
/**
* The Constant BOTTOM_ALIGNMENT indicates the bottom alignment of the
* component.
*/
public static final float BOTTOM_ALIGNMENT = 1.0f;
/**
* The Constant LEFT_ALIGNMENT indicates the left alignment of the
* component.
*/
public static final float LEFT_ALIGNMENT = 0.0f;
/**
* The Constant RIGHT_ALIGNMENT indicates the right alignment of the
* component.
*/
public static final float RIGHT_ALIGNMENT = 1.0f;
/**
* The Constant childClassesFlags.
*/
private static final Hashtable<Class<?>, Boolean> childClassesFlags = new Hashtable<Class<?>, Boolean>();
/**
* The Constant peer.
*/
private static final ComponentPeer peer = new ComponentPeer() {
};
/**
* The Constant incrementalImageUpdate.
*/
private static final boolean incrementalImageUpdate;
/**
* The toolkit.
*/
final transient Toolkit toolkit = Toolkit.getDefaultToolkit();
// ???AWT
/*
* protected abstract class AccessibleAWTComponent extends AccessibleContext
* implements Serializable, AccessibleComponent { private static final long
* serialVersionUID = 642321655757800191L; protected class
* AccessibleAWTComponentHandler implements ComponentListener { protected
* AccessibleAWTComponentHandler() { } public void
* componentHidden(ComponentEvent e) { if (behaviour.isLightweight()) {
* return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
* AccessibleState.VISIBLE, null); } public void
* componentMoved(ComponentEvent e) { } public void
* componentResized(ComponentEvent e) { } public void
* componentShown(ComponentEvent e) { if (behaviour.isLightweight()) {
* return; } firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
* null, AccessibleState.VISIBLE); } } protected class
* AccessibleAWTFocusHandler implements FocusListener { public void
* focusGained(FocusEvent e) { if (behaviour.isLightweight()) { return; }
* firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
* AccessibleState.FOCUSED); } public void focusLost(FocusEvent e) { if
* (behaviour.isLightweight()) { return; }
* firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
* AccessibleState.FOCUSED, null); } } protected ComponentListener
* accessibleAWTComponentHandler; protected FocusListener
* accessibleAWTFocusHandler;
*/
/*
* Number of registered property change listeners.
*/
/*
* int listenersCount; public void addFocusListener(FocusListener l) {
* Component.this.addFocusListener(l); }
* @Override public void addPropertyChangeListener(PropertyChangeListener
* listener) { toolkit.lockAWT(); try {
* super.addPropertyChangeListener(listener); listenersCount++; if
* (accessibleAWTComponentHandler == null) { accessibleAWTComponentHandler =
* new AccessibleAWTComponentHandler();
* Component.this.addComponentListener(accessibleAWTComponentHandler); } if
* (accessibleAWTFocusHandler == null) { accessibleAWTFocusHandler = new
* AccessibleAWTFocusHandler();
* Component.this.addFocusListener(accessibleAWTFocusHandler); } } finally {
* toolkit.unlockAWT(); } } public boolean contains(Point p) {
* toolkit.lockAWT(); try { return Component.this.contains(p); } finally {
* toolkit.unlockAWT(); } } public Accessible getAccessibleAt(Point arg0) {
* toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); }
* } public Color getBackground() { toolkit.lockAWT(); try { return
* Component.this.getBackground(); } finally { toolkit.unlockAWT(); } }
* public Rectangle getBounds() { toolkit.lockAWT(); try { return
* Component.this.getBounds(); } finally { toolkit.unlockAWT(); } } public
* Cursor getCursor() { toolkit.lockAWT(); try { return
* Component.this.getCursor(); } finally { toolkit.unlockAWT(); } } public
* Font getFont() { toolkit.lockAWT(); try { return
* Component.this.getFont(); } finally { toolkit.unlockAWT(); } } public
* FontMetrics getFontMetrics(Font f) { toolkit.lockAWT(); try { return
* Component.this.getFontMetrics(f); } finally { toolkit.unlockAWT(); } }
* public Color getForeground() { toolkit.lockAWT(); try { return
* Component.this.getForeground(); } finally { toolkit.unlockAWT(); } }
* public Point getLocation() { toolkit.lockAWT(); try { return
* Component.this.getLocation(); } finally { toolkit.unlockAWT(); } } public
* Point getLocationOnScreen() { toolkit.lockAWT(); try { return
* Component.this.getLocationOnScreen(); } finally { toolkit.unlockAWT(); }
* } public Dimension getSize() { toolkit.lockAWT(); try { return
* Component.this.getSize(); } finally { toolkit.unlockAWT(); } } public
* boolean isEnabled() { toolkit.lockAWT(); try { return
* Component.this.isEnabled(); } finally { toolkit.unlockAWT(); } } public
* boolean isFocusTraversable() { toolkit.lockAWT(); try { return
* Component.this.isFocusTraversable(); } finally { toolkit.unlockAWT(); } }
* public boolean isShowing() { toolkit.lockAWT(); try { return
* Component.this.isShowing(); } finally { toolkit.unlockAWT(); } } public
* boolean isVisible() { toolkit.lockAWT(); try { return
* Component.this.isVisible(); } finally { toolkit.unlockAWT(); } } public
* void removeFocusListener(FocusListener l) {
* Component.this.removeFocusListener(l); }
* @Override public void removePropertyChangeListener(PropertyChangeListener
* listener) { toolkit.lockAWT(); try {
* super.removePropertyChangeListener(listener); listenersCount--; if
* (listenersCount > 0) { return; } // if there are no more listeners,
* remove handlers:
* Component.this.removeFocusListener(accessibleAWTFocusHandler);
* Component.this.removeComponentListener(accessibleAWTComponentHandler);
* accessibleAWTComponentHandler = null; accessibleAWTFocusHandler = null; }
* finally { toolkit.unlockAWT(); } } public void requestFocus() {
* toolkit.lockAWT(); try { Component.this.requestFocus(); } finally {
* toolkit.unlockAWT(); } } public void setBackground(Color color) {
* toolkit.lockAWT(); try { Component.this.setBackground(color); } finally {
* toolkit.unlockAWT(); } } public void setBounds(Rectangle r) {
* toolkit.lockAWT(); try { Component.this.setBounds(r); } finally {
* toolkit.unlockAWT(); } } public void setCursor(Cursor cursor) {
* toolkit.lockAWT(); try { Component.this.setCursor(cursor); } finally {
* toolkit.unlockAWT(); } } public void setEnabled(boolean enabled) {
* toolkit.lockAWT(); try { Component.this.setEnabled(enabled); } finally {
* toolkit.unlockAWT(); } } public void setFont(Font f) { toolkit.lockAWT();
* try { Component.this.setFont(f); } finally { toolkit.unlockAWT(); } }
* public void setForeground(Color color) { toolkit.lockAWT(); try {
* Component.this.setForeground(color); } finally { toolkit.unlockAWT(); } }
* public void setLocation(Point p) { toolkit.lockAWT(); try {
* Component.this.setLocation(p); } finally { toolkit.unlockAWT(); } }
* public void setSize(Dimension size) { toolkit.lockAWT(); try {
* Component.this.setSize(size); } finally { toolkit.unlockAWT(); } } public
* void setVisible(boolean visible) { toolkit.lockAWT(); try {
* Component.this.setVisible(visible); } finally { toolkit.unlockAWT(); } }
* @Override public Accessible getAccessibleParent() { toolkit.lockAWT();
* try { Accessible aParent = super.getAccessibleParent(); if (aParent !=
* null) { return aParent; } Container parent = getParent(); return (parent
* instanceof Accessible ? (Accessible) parent : null); } finally {
* toolkit.unlockAWT(); } }
* @Override public Accessible getAccessibleChild(int i) {
* toolkit.lockAWT(); try { return null; } finally { toolkit.unlockAWT(); }
* }
* @Override public int getAccessibleChildrenCount() { toolkit.lockAWT();
* try { return 0; } finally { toolkit.unlockAWT(); } }
* @Override public AccessibleComponent getAccessibleComponent() { return
* this; }
* @Override public String getAccessibleDescription() { return
* super.getAccessibleDescription(); // why override? }
* @Override public int getAccessibleIndexInParent() { toolkit.lockAWT();
* try { if (getAccessibleParent() == null) { return -1; } int count = 0;
* Container parent = getParent(); for (int i = 0; i <
* parent.getComponentCount(); i++) { Component aComp =
* parent.getComponent(i); if (aComp instanceof Accessible) { if (aComp ==
* Component.this) { return count; } ++count; } } return -1; } finally {
* toolkit.unlockAWT(); } }
* @Override public AccessibleRole getAccessibleRole() { toolkit.lockAWT();
* try { return AccessibleRole.AWT_COMPONENT; } finally {
* toolkit.unlockAWT(); } }
* @Override public AccessibleStateSet getAccessibleStateSet() {
* toolkit.lockAWT(); try { AccessibleStateSet set = new
* AccessibleStateSet(); if (isEnabled()) {
* set.add(AccessibleState.ENABLED); } if (isFocusable()) {
* set.add(AccessibleState.FOCUSABLE); } if (hasFocus()) {
* set.add(AccessibleState.FOCUSED); } if (isOpaque()) {
* set.add(AccessibleState.OPAQUE); } if (isShowing()) {
* set.add(AccessibleState.SHOWING); } if (isVisible()) {
* set.add(AccessibleState.VISIBLE); } return set; } finally {
* toolkit.unlockAWT(); } }
* @Override public Locale getLocale() throws IllegalComponentStateException
* { toolkit.lockAWT(); try { return Component.this.getLocale(); } finally {
* toolkit.unlockAWT(); } } }
*/
/**
* The BltBufferStrategy class provides opportunity of blitting offscreen
* surfaces to a component. For more information on blitting, see <a
* href="http://en.wikipedia.org/wiki/Bit_blit">Bit blit</a>.
*
* @since Android 1.0
*/
protected class BltBufferStrategy extends BufferStrategy {
/**
* The back buffers.
*/
protected VolatileImage[] backBuffers;
/**
* The caps.
*/
protected BufferCapabilities caps;
/**
* The width.
*/
protected int width;
/**
* The height.
*/
protected int height;
/**
* The validated contents.
*/
protected boolean validatedContents;
/**
* Instantiates a new BltBufferStrategy buffer strategy.
*
* @param numBuffers
* the number of buffers.
* @param caps
* the BufferCapabilities.
* @throws NotImplementedException
* the not implemented exception.
*/
protected BltBufferStrategy(int numBuffers, BufferCapabilities caps)
throws org.apache.harmony.luni.util.NotImplementedException {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Returns true if the drawing buffer has been lost since the last call
* to getDrawGraphics.
*
* @return true if the drawing buffer has been lost since the last call
* to getDrawGraphics, false otherwise.
* @see java.awt.image.BufferStrategy#contentsLost()
*/
@Override
public boolean contentsLost() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return false;
}
/**
* Returns true if the drawing buffer has been restored from a lost
* state and reinitialized to the default background color.
*
* @return true if the drawing buffer has been restored from a lost
* state and reinitialized to the default background color,
* false otherwise.
* @see java.awt.image.BufferStrategy#contentsRestored()
*/
@Override
public boolean contentsRestored() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return false;
}
/**
* Creates the back buffers.
*
* @param numBuffers
* the number of buffers.
*/
protected void createBackBuffers(int numBuffers) {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Returns the BufferCapabilities of the buffer strategy.
*
* @return the BufferCapabilities.
* @see java.awt.image.BufferStrategy#getCapabilities()
*/
@Override
public BufferCapabilities getCapabilities() {
return (BufferCapabilities)caps.clone();
}
/**
* Gets Graphics of current buffer strategy.
*
* @return the Graphics of current buffer strategy.
* @see java.awt.image.BufferStrategy#getDrawGraphics()
*/
@Override
public Graphics getDrawGraphics() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return null;
}
/**
* Revalidates the lost drawing buffer.
*/
protected void revalidate() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Shows the next available buffer.
*
* @see java.awt.image.BufferStrategy#show()
*/
@Override
public void show() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
}
/**
* The FlipBufferStrategy class is for flipping buffers on a component.
*
* @since Android 1.0
*/
protected class FlipBufferStrategy extends BufferStrategy {
/**
* The Buffer Capabilities.
*/
protected BufferCapabilities caps;
/**
* The drawing buffer.
*/
protected Image drawBuffer;
/**
* The drawing VolatileImage buffer.
*/
protected VolatileImage drawVBuffer;
/**
* The number of buffers.
*/
protected int numBuffers;
/**
* The validated contents indicates if the drawing buffer is restored
* from lost state.
*/
protected boolean validatedContents;
/**
* Instantiates a new flip buffer strategy.
*
* @param numBuffers
* the number of buffers.
* @param caps
* the BufferCapabilities.
* @throws AWTException
* if the capabilities supplied could not be supported or
* met.
*/
protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException {
// ???AWT
/*
* if (!(Component.this instanceof Window) && !(Component.this
* instanceof Canvas)) { // awt.14B=Only Canvas or Window is allowed
* throw new ClassCastException(Messages.getString("awt.14B"));
* //$NON-NLS-1$ }
*/
// TODO: throw new AWTException("Capabilities are not supported");
this.numBuffers = numBuffers;
this.caps = (BufferCapabilities)caps.clone();
}
/**
* Returns true if the drawing buffer has been lost since the last call
* to getDrawGraphics.
*
* @return true if the drawing buffer has been lost since the last call
* to getDrawGraphics, false otherwise.
* @see java.awt.image.BufferStrategy#contentsLost()
*/
@Override
public boolean contentsLost() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return false;
}
/**
* Returns true if the drawing buffer has been restored from a lost
* state and reinitialized to the default background color.
*
* @return true if the drawing buffer has been restored from a lost
* state and reinitialized to the default background color,
* false otherwise.
* @see java.awt.image.BufferStrategy#contentsRestored()
*/
@Override
public boolean contentsRestored() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return false;
}
/**
* Creates flipping buffers with the specified buffer capabilities.
*
* @param numBuffers
* the number of buffers.
* @param caps
* the BufferCapabilities.
* @throws AWTException
* if the capabilities could not be supported or met.
*/
protected void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException {
if (numBuffers < 2) {
// awt.14C=Number of buffers must be greater than one
throw new IllegalArgumentException(Messages.getString("awt.14C")); //$NON-NLS-1$
}
if (!caps.isPageFlipping()) {
// awt.14D=Buffer capabilities should support flipping
throw new IllegalArgumentException(Messages.getString("awt.14D")); //$NON-NLS-1$
}
if (!Component.this.behaviour.isDisplayable()) {
// awt.14E=Component should be displayable
throw new IllegalStateException(Messages.getString("awt.14E")); //$NON-NLS-1$
}
// TODO: throw new AWTException("Capabilities are not supported");
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Destroy buffers.
*/
protected void destroyBuffers() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Flips the contents of the back buffer to the front buffer.
*
* @param flipAction
* the flip action.
*/
protected void flip(BufferCapabilities.FlipContents flipAction) {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Gets the back buffer as Image.
*
* @return the back buffer as Image.
*/
protected Image getBackBuffer() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return null;
}
/**
* Returns the BufferCapabilities of the buffer strategy.
*
* @return the BufferCapabilities.
* @see java.awt.image.BufferStrategy#getCapabilities()
*/
@Override
public BufferCapabilities getCapabilities() {
return (BufferCapabilities)caps.clone();
}
/**
* Gets Graphics of current buffer strategy.
*
* @return the Graphics of current buffer strategy.
* @see java.awt.image.BufferStrategy#getDrawGraphics()
*/
@Override
public Graphics getDrawGraphics() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
return null;
}
/**
* Revalidates the lost drawing buffer.
*/
protected void revalidate() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
/**
* Shows the next available buffer.
*
* @see java.awt.image.BufferStrategy#show()
*/
@Override
public void show() {
if (true) {
throw new RuntimeException("Method is not implemented"); //$NON-NLS-1$
}
}
}
/**
* The internal component's state utilized by the visual theme.
*/
class ComponentState implements State {
/**
* The default minimum size.
*/
private Dimension defaultMinimumSize = new Dimension();
/**
* Checks if the component is enabled.
*
* @return true, if the component is enabled.
*/
public boolean isEnabled() {
return enabled;
}
/**
* Checks if the component is visible.
*
* @return true, if the component is visible.
*/
public boolean isVisible() {
return visible;
}
/**
* Checks if is focused.
*
* @return true, if is focused.
*/
public boolean isFocused() {
// ???AWT: return isFocusOwner();
return false;
}
/**
* Gets the font.
*
* @return the font.
*/
public Font getFont() {
return Component.this.getFont();
}
/**
* Checks if the font has been set.
*
* @return true, if the font has been set.
*/
public boolean isFontSet() {
return font != null;
}
/**
* Gets the background color.
*
* @return the background color.
*/
public Color getBackground() {
Color c = Component.this.getBackground();
return (c != null) ? c : getDefaultBackground();
}
/**
* Checks if the background is set.
*
* @return true, if the background is set.
*/
public boolean isBackgroundSet() {
return backColor != null;
}
/**
* Gets the text color.
*
* @return the text color.
*/
public Color getTextColor() {
Color c = getForeground();
return (c != null) ? c : getDefaultForeground();
}
/**
* Checks if the text color is set.
*
* @return true, if the text color is set.
*/
public boolean isTextColorSet() {
return foreColor != null;
}
/**
* Gets the font metrics.
*
* @return the font metrics.
*/
@SuppressWarnings("deprecation")
public FontMetrics getFontMetrics() {
return toolkit.getFontMetrics(Component.this.getFont());
}
/**
* Gets the bounding rectangle.
*
* @return the bounding rectangle.
*/
public Rectangle getBounds() {
return new Rectangle(x, y, w, h);
}
/**
* Gets the size of the bounding rectangle.
*
* @return the size of the bounding rectangle.
*/
public Dimension getSize() {
return new Dimension(w, h);
}
/**
* Gets the window id.
*
* @return the window id.
*/
public long getWindowId() {
NativeWindow win = getNativeWindow();
return (win != null) ? win.getId() : 0;
}
/**
* Gets the default minimum size.
*
* @return the default minimum size.
*/
public Dimension getDefaultMinimumSize() {
if (defaultMinimumSize == null) {
calculate();
}
return defaultMinimumSize;
}
/**
* Sets the default minimum size.
*
* @param size
* the new default minimum size.
*/
public void setDefaultMinimumSize(Dimension size) {
defaultMinimumSize = size;
}
/**
* Reset the default minimum size to null.
*/
public void reset() {
defaultMinimumSize = null;
}
/**
* Calculate the default minimum size: to be overridden.
*/
public void calculate() {
// to be overridden
}
}
// ???AWT: private transient AccessibleContext accessibleContext;
/**
* The behaviour.
*/
final transient ComponentBehavior behaviour;
// ???AWT: Container parent;
/**
* The name.
*/
private String name;
/**
* The auto name.
*/
private boolean autoName = true;
/**
* The font.
*/
private Font font;
/**
* The back color.
*/
private Color backColor;
/**
* The fore color.
*/
private Color foreColor;
/**
* The deprecated event handler.
*/
boolean deprecatedEventHandler = true;
/**
* The enabled events.
*/
private long enabledEvents;
/**
* The enabled AWT events.
*/
private long enabledAWTEvents;
/**
* The component listeners.
*/
private final AWTListenerList<ComponentListener> componentListeners = new AWTListenerList<ComponentListener>(
this);
/**
* The focus listeners.
*/
private final AWTListenerList<FocusListener> focusListeners = new AWTListenerList<FocusListener>(
this);
/**
* The hierarchy listeners.
*/
private final AWTListenerList<HierarchyListener> hierarchyListeners = new AWTListenerList<HierarchyListener>(
this);
/**
* The hierarchy bounds listeners.
*/
private final AWTListenerList<HierarchyBoundsListener> hierarchyBoundsListeners = new AWTListenerList<HierarchyBoundsListener>(
this);
/**
* The key listeners.
*/
private final AWTListenerList<KeyListener> keyListeners = new AWTListenerList<KeyListener>(this);
/**
* The mouse listeners.
*/
private final AWTListenerList<MouseListener> mouseListeners = new AWTListenerList<MouseListener>(
this);
/**
* The mouse motion listeners.
*/
private final AWTListenerList<MouseMotionListener> mouseMotionListeners = new AWTListenerList<MouseMotionListener>(
this);
/**
* The mouse wheel listeners.
*/
private final AWTListenerList<MouseWheelListener> mouseWheelListeners = new AWTListenerList<MouseWheelListener>(
this);
/**
* The input method listeners.
*/
private final AWTListenerList<InputMethodListener> inputMethodListeners = new AWTListenerList<InputMethodListener>(
this);
/**
* The x.
*/
int x;
/**
* The y.
*/
int y;
/**
* The w.
*/
int w;
/**
* The h.
*/
int h;
/**
* The maximum size.
*/
private Dimension maximumSize;
/**
* The minimum size.
*/
private Dimension minimumSize;
/**
* The preferred size.
*/
private Dimension preferredSize;
/**
* The bounds mask param.
*/
private int boundsMaskParam;
/**
* The ignore repaint.
*/
private boolean ignoreRepaint;
/**
* The enabled.
*/
private boolean enabled = true;
/**
* The input methods enabled.
*/
private boolean inputMethodsEnabled = true;
/**
* The dispatch to im.
*/
transient boolean dispatchToIM = true;
/**
* The focusable.
*/
private boolean focusable = true; // By default, all Components return
// true from isFocusable() method
/**
* The visible.
*/
boolean visible = true;
/**
* The called set focusable.
*/
private boolean calledSetFocusable;
/**
* The overridden is focusable.
*/
private boolean overridenIsFocusable = true;
/**
* The focus traversal keys enabled.
*/
private boolean focusTraversalKeysEnabled = true;
/**
* Possible keys are: FORWARD_TRAVERSAL_KEYS, BACKWARD_TRAVERSAL_KEYS,
* UP_CYCLE_TRAVERSAL_KEYS.
*/
private final Map<Integer, Set<? extends AWTKeyStroke>> traversalKeys = new HashMap<Integer, Set<? extends AWTKeyStroke>>();
/**
* The traversal i ds.
*/
int[] traversalIDs;