Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f1f03a8c
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f1f03a8c
编写于
9月 23, 2013
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8005255: [macosx] Cleanup warnings in sun.lwawt
Reviewed-by: alexsch, anthony
上级
a460ab1d
变更
21
显示空白变更内容
内联
并排
Showing
21 changed file
with
233 addition
and
201 deletion
+233
-201
make/sun/lwawt/FILES_export_macosx.gmk
make/sun/lwawt/FILES_export_macosx.gmk
+0
-1
src/macosx/classes/sun/lwawt/LWButtonPeer.java
src/macosx/classes/sun/lwawt/LWButtonPeer.java
+7
-2
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
+5
-1
src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
+9
-3
src/macosx/classes/sun/lwawt/LWChoicePeer.java
src/macosx/classes/sun/lwawt/LWChoicePeer.java
+6
-1
src/macosx/classes/sun/lwawt/LWComponentPeer.java
src/macosx/classes/sun/lwawt/LWComponentPeer.java
+53
-37
src/macosx/classes/sun/lwawt/LWContainerPeer.java
src/macosx/classes/sun/lwawt/LWContainerPeer.java
+43
-46
src/macosx/classes/sun/lwawt/LWCursorManager.java
src/macosx/classes/sun/lwawt/LWCursorManager.java
+4
-2
src/macosx/classes/sun/lwawt/LWLabelPeer.java
src/macosx/classes/sun/lwawt/LWLabelPeer.java
+2
-2
src/macosx/classes/sun/lwawt/LWListPeer.java
src/macosx/classes/sun/lwawt/LWListPeer.java
+10
-6
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
+4
-5
src/macosx/classes/sun/lwawt/LWPanelPeer.java
src/macosx/classes/sun/lwawt/LWPanelPeer.java
+6
-2
src/macosx/classes/sun/lwawt/LWRepaintArea.java
src/macosx/classes/sun/lwawt/LWRepaintArea.java
+12
-13
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
+6
-2
src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
+12
-8
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
+6
-7
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
+7
-4
src/macosx/classes/sun/lwawt/LWTextFieldPeer.java
src/macosx/classes/sun/lwawt/LWTextFieldPeer.java
+8
-3
src/macosx/classes/sun/lwawt/LWToolkit.java
src/macosx/classes/sun/lwawt/LWToolkit.java
+8
-6
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+25
-16
src/macosx/classes/sun/lwawt/SelectionClearListener.java
src/macosx/classes/sun/lwawt/SelectionClearListener.java
+0
-34
未找到文件。
make/sun/lwawt/FILES_export_macosx.gmk
浏览文件 @
f1f03a8c
...
...
@@ -110,7 +110,6 @@ FILES_export = \
sun/lwawt/LWWindowPeer.java \
sun/lwawt/PlatformWindow.java \
sun/lwawt/SecurityWarningWindow.java \
sun/lwawt/SelectionClearListener.java \
sun/lwawt/macosx/CPrinterDevice.java \
sun/lwawt/macosx/CPrinterDialog.java \
sun/lwawt/macosx/CPrinterDialogPeer.java \
...
...
src/macosx/classes/sun/lwawt/LWButtonPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -33,6 +33,10 @@ import java.awt.peer.ButtonPeer;
import
javax.swing.JButton
;
/**
* Lightweight implementation of {@link ButtonPeer}. Delegates most of the work
* to the {@link JButton}.
*/
final
class
LWButtonPeer
extends
LWComponentPeer
<
Button
,
JButton
>
implements
ButtonPeer
,
ActionListener
{
...
...
@@ -42,7 +46,7 @@ final class LWButtonPeer extends LWComponentPeer<Button, JButton>
}
@Override
protected
JButton
createDelegate
()
{
JButton
createDelegate
()
{
return
new
JButtonDelegate
();
}
...
...
@@ -74,6 +78,7 @@ final class LWButtonPeer extends LWComponentPeer<Button, JButton>
return
true
;
}
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
private
final
class
JButtonDelegate
extends
JButton
{
// Empty non private constructor was added because access to this
...
...
src/macosx/classes/sun/lwawt/LWCanvasPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -33,6 +33,10 @@ import java.awt.peer.CanvasPeer;
import
javax.swing.JComponent
;
/**
* Lightweight implementation of {@link CanvasPeer}. This peer is empty, because
* all the components in lwawt use graphic object from the top level window.
*/
class
LWCanvasPeer
<
T
extends
Component
,
D
extends
JComponent
>
extends
LWComponentPeer
<
T
,
D
>
implements
CanvasPeer
{
...
...
src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -41,6 +41,11 @@ import javax.swing.JRadioButton;
import
javax.swing.JToggleButton
;
import
javax.swing.SwingUtilities
;
/**
* Lightweight implementation of {@link CheckboxPeer}. Delegates most of the
* work to the {@link JCheckBox} and {@link JRadioButton}, which are placed
* inside an empty {@link JComponent}.
*/
final
class
LWCheckboxPeer
extends
LWComponentPeer
<
Checkbox
,
LWCheckboxPeer
.
CheckboxDelegate
>
implements
CheckboxPeer
,
ItemListener
{
...
...
@@ -51,12 +56,12 @@ final class LWCheckboxPeer
}
@Override
protected
CheckboxDelegate
createDelegate
()
{
CheckboxDelegate
createDelegate
()
{
return
new
CheckboxDelegate
();
}
@Override
protected
Component
getDelegateFocusOwner
()
{
Component
getDelegateFocusOwner
()
{
return
getDelegate
().
getCurrentButton
();
}
...
...
@@ -137,6 +142,7 @@ final class LWCheckboxPeer
return
true
;
}
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
final
class
CheckboxDelegate
extends
JComponent
{
private
final
JCheckBox
cb
;
...
...
src/macosx/classes/sun/lwawt/LWChoicePeer.java
浏览文件 @
f1f03a8c
...
...
@@ -34,6 +34,10 @@ import java.awt.peer.ChoicePeer;
import
javax.accessibility.Accessible
;
import
javax.swing.*
;
/**
* Lightweight implementation of {@link ChoicePeer}. Delegates most of the work
* to the {@link JComboBox}.
*/
final
class
LWChoicePeer
extends
LWComponentPeer
<
Choice
,
JComboBox
<
String
>>
implements
ChoicePeer
,
ItemListener
{
...
...
@@ -50,7 +54,7 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
}
@Override
protected
JComboBox
<
String
>
createDelegate
()
{
JComboBox
<
String
>
createDelegate
()
{
return
new
JComboBoxDelegate
();
}
...
...
@@ -128,6 +132,7 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
return
true
;
}
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
private
final
class
JComboBoxDelegate
extends
JComboBox
<
String
>
{
// Empty non private constructor was added because access to this
...
...
src/macosx/classes/sun/lwawt/LWComponentPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -72,19 +72,23 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
{
private
static
final
PlatformLogger
focusLog
=
PlatformLogger
.
getLogger
(
"sun.lwawt.focus.LWComponentPeer"
);
// State lock is to be used for modifications to this
// peer's fields (e.g. bounds, background, font, etc.)
// It should be the last lock in the lock chain
private
final
Object
stateLock
=
new
StringBuilder
(
"LWComponentPeer.stateLock"
);
/**
* State lock is to be used for modifications to this peer's fields (e.g.
* bounds, background, font, etc.) It should be the last lock in the lock
* chain
*/
private
final
Object
stateLock
=
new
Object
();
/
/ The lock to operate with the peers hierarchy. AWT tree
// lock is not used as there are many peers related ops
// to be done on the toolkit thread, and we don't want to
//
depend on a public lock on this thread
private
static
final
Object
peerTreeLock
=
new
StringBuilder
(
"LWComponentPeer.peerTreeLock"
);
/
**
* The lock to operate with the peers hierarchy. AWT tree lock is not used
* as there are many peers related ops to be done on the toolkit thread, and
* we don't want to
depend on a public lock on this thread
*/
private
static
final
Object
peerTreeLock
=
new
Object
(
);
/**
* The associated AWT object.
*/
private
final
T
target
;
/**
...
...
@@ -95,7 +99,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* the hierarchy. The exception is LWWindowPeers: their containers are
* always null
*/
private
final
LWContainerPeer
containerPeer
;
private
final
LWContainerPeer
<?,
?>
containerPeer
;
/**
* Handy reference to the top-level window peer. Window peer is borrowed
...
...
@@ -147,11 +151,18 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
*/
private
Image
backBuffer
;
/**
* All Swing delegates use delegateContainer as a parent. This container
* intentionally do not use parent of the peer.
*/
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
private
final
class
DelegateContainer
extends
Container
{
{
enableEvents
(
0xFFFFFFFF
);
}
// Empty non private constructor was added because access to this
// class shouldn't be emulated by a synthetic accessor method.
DelegateContainer
()
{
super
();
}
...
...
@@ -182,7 +193,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
}
public
LWComponentPeer
(
T
target
,
PlatformComponent
platformComponent
)
{
LWComponentPeer
(
final
T
target
,
final
PlatformComponent
platformComponent
)
{
targetPaintArea
=
new
LWRepaintArea
();
this
.
target
=
target
;
this
.
platformComponent
=
platformComponent
;
...
...
@@ -276,15 +287,18 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* This method is called under getDelegateLock().
* Overridden in subclasses.
*/
protected
D
createDelegate
()
{
D
createDelegate
()
{
return
null
;
}
protected
final
D
getDelegate
()
{
final
D
getDelegate
()
{
return
delegate
;
}
protected
Component
getDelegateFocusOwner
()
{
/**
* This method should be called under getDelegateLock().
*/
Component
getDelegateFocusOwner
()
{
return
getDelegate
();
}
...
...
@@ -356,7 +370,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
// Just a helper method
protected
final
LWContainerPeer
getContainerPeer
()
{
protected
final
LWContainerPeer
<?,
?>
getContainerPeer
()
{
return
containerPeer
;
}
...
...
@@ -390,7 +404,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
protected
void
disposeImpl
()
{
destroyBuffers
();
LWContainerPeer
cp
=
getContainerPeer
();
LWContainerPeer
<?,
?>
cp
=
getContainerPeer
();
if
(
cp
!=
null
)
{
cp
.
removeChildPeer
(
this
);
}
...
...
@@ -462,12 +476,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
sg2d
.
constrain
(
size
.
x
,
size
.
y
,
size
.
width
,
size
.
height
,
getVisibleRegion
());
}
public
Region
getVisibleRegion
()
{
Region
getVisibleRegion
()
{
return
computeVisibleRect
(
this
,
getRegion
());
}
static
final
Region
computeVisibleRect
(
LWComponentPeer
c
,
Region
region
)
{
final
LWContainerPeer
p
=
c
.
getContainerPeer
();
static
final
Region
computeVisibleRect
(
final
LWComponentPeer
<?,
?>
c
,
Region
region
)
{
final
LWContainerPeer
<?,
?>
p
=
c
.
getContainerPeer
();
if
(
p
!=
null
)
{
final
Rectangle
r
=
c
.
getBounds
();
region
=
region
.
getTranslatedRegion
(
r
.
x
,
r
.
y
);
...
...
@@ -612,7 +627,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* @param p Point relative to the peer.
* @return Cursor of the peer or null if default cursor should be used.
*/
protected
Cursor
getCursor
(
final
Point
p
)
{
Cursor
getCursor
(
final
Point
p
)
{
return
getTarget
().
getCursor
();
}
...
...
@@ -717,7 +732,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@Override
public
void
setEnabled
(
final
boolean
e
)
{
boolean
status
=
e
;
final
LWComponentPeer
cp
=
getContainerPeer
();
final
LWComponentPeer
<?,
?>
cp
=
getContainerPeer
();
if
(
cp
!=
null
)
{
status
&=
cp
.
isEnabled
();
}
...
...
@@ -802,12 +817,12 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
@Override
public
void
setZOrder
(
ComponentPeer
above
)
{
LWContainerPeer
cp
=
getContainerPeer
();
public
void
setZOrder
(
final
ComponentPeer
above
)
{
LWContainerPeer
<?,
?>
cp
=
getContainerPeer
();
// Don't check containerPeer for null as it can only happen
// for windows, but this method is overridden in
// LWWindowPeer and doesn't call super()
cp
.
setChildPeerZOrder
(
this
,
(
LWComponentPeer
)
above
);
cp
.
setChildPeerZOrder
(
this
,
(
LWComponentPeer
<?,
?>
)
above
);
}
@Override
...
...
@@ -923,7 +938,9 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
return
false
;
}
LWWindowPeer
parentPeer
=
(
LWWindowPeer
)
parentWindow
.
getPeer
();
final
LWWindowPeer
parentPeer
=
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
()
.
getPeer
(
parentWindow
);
if
(
parentPeer
==
null
)
{
focusLog
.
fine
(
"request rejected, parentPeer is null"
);
LWKeyboardFocusManagerPeer
.
removeLastFocusRequest
(
getTarget
());
...
...
@@ -1138,7 +1155,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
protected
final
void
repaintParent
(
final
Rectangle
oldB
)
{
final
LWContainerPeer
cp
=
getContainerPeer
();
final
LWContainerPeer
<?,
?>
cp
=
getContainerPeer
();
if
(
cp
!=
null
)
{
// Repaint unobscured part of the parent
cp
.
repaintPeer
(
cp
.
getContentSize
().
intersection
(
oldB
));
...
...
@@ -1275,7 +1292,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
/**
* Handler for FocusEvents.
*/
protected
void
handleJavaFocusEvent
(
FocusEvent
e
)
{
void
handleJavaFocusEvent
(
final
FocusEvent
e
)
{
// Note that the peer receives all the FocusEvents from
// its lightweight children as well
KeyboardFocusManagerPeer
kfmPeer
=
LWKeyboardFocusManagerPeer
.
getInstance
();
...
...
@@ -1311,7 +1328,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* Finds a top-most visible component for the given point. The location is
* specified relative to the peer's parent.
*/
public
LWComponentPeer
findPeerAt
(
final
int
x
,
final
int
y
)
{
LWComponentPeer
<?,
?>
findPeerAt
(
final
int
x
,
final
int
y
)
{
final
Rectangle
r
=
getBounds
();
final
Region
sh
=
getRegion
();
final
boolean
found
=
isVisible
()
&&
sh
.
contains
(
x
-
r
.
x
,
y
-
r
.
y
);
...
...
@@ -1328,7 +1345,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
public
Point
windowToLocal
(
Point
p
,
LWWindowPeer
wp
)
{
LWComponentPeer
cp
=
this
;
LWComponentPeer
<?,
?>
cp
=
this
;
while
(
cp
!=
wp
)
{
Rectangle
cpb
=
cp
.
getBounds
();
p
.
x
-=
cpb
.
x
;
...
...
@@ -1349,7 +1366,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
public
Point
localToWindow
(
Point
p
)
{
LWComponentPeer
cp
=
getContainerPeer
();
LWComponentPeer
<?,
?>
cp
=
getContainerPeer
();
Rectangle
r
=
getBounds
();
while
(
cp
!=
null
)
{
p
.
x
+=
r
.
x
;
...
...
@@ -1370,7 +1387,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
repaintPeer
(
getSize
());
}
public
void
repaintPeer
(
final
Rectangle
r
)
{
void
repaintPeer
(
final
Rectangle
r
)
{
final
Rectangle
toPaint
=
getSize
().
intersection
(
r
);
if
(!
isShowing
()
||
toPaint
.
isEmpty
())
{
return
;
...
...
@@ -1389,7 +1406,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
protected
final
boolean
isShowing
()
{
synchronized
(
getPeerTreeLock
())
{
if
(
isVisible
())
{
final
LWContainerPeer
container
=
getContainerPeer
();
final
LWContainerPeer
<?,
?>
container
=
getContainerPeer
();
return
(
container
==
null
)
||
container
.
isShowing
();
}
}
...
...
@@ -1397,8 +1414,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
/**
* Paints the peer. Overridden in subclasses to delegate the actual painting
* to Swing components.
* Paints the peer. Delegate the actual painting to Swing components.
*/
protected
final
void
paintPeer
(
final
Graphics
g
)
{
final
D
delegate
=
getDelegate
();
...
...
src/macosx/classes/sun/lwawt/LWContainerPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -41,32 +41,25 @@ import java.util.List;
import
javax.swing.JComponent
;
abstract
class
LWContainerPeer
<
T
extends
Container
,
D
extends
JComponent
>
extends
LWCanvasPeer
<
T
,
D
>
implements
ContainerPeer
{
// List of child peers sorted by z-order from bottom-most
// to top-most
private
List
<
LWComponentPeer
>
childPeers
=
new
LinkedList
<
LWComponentPeer
>();
LWContainerPeer
(
T
target
,
PlatformComponent
platformComponent
)
{
super
(
target
,
platformComponent
);
}
extends
LWCanvasPeer
<
T
,
D
>
implements
ContainerPeer
{
void
addChildPeer
(
LWComponentPeer
child
)
{
synchronized
(
getPeerTreeLock
())
{
addChildPeer
(
child
,
childPeers
.
size
());
}
/**
* List of child peers sorted by z-order from bottom-most to top-most.
*/
private
final
List
<
LWComponentPeer
<?,
?>>
childPeers
=
new
LinkedList
<>();
LWContainerPeer
(
final
T
target
,
final
PlatformComponent
platformComponent
)
{
super
(
target
,
platformComponent
);
}
void
addChildPeer
(
LWComponentPeer
child
,
int
index
)
{
final
void
addChildPeer
(
final
LWComponentPeer
<?,
?>
child
)
{
synchronized
(
getPeerTreeLock
())
{
childPeers
.
add
(
index
,
child
);
}
childPeers
.
add
(
childPeers
.
size
(),
child
);
// TODO: repaint
}
}
void
removeChildPeer
(
LWComponentPeer
child
)
{
final
void
removeChildPeer
(
final
LWComponentPeer
<?,
?>
child
)
{
synchronized
(
getPeerTreeLock
())
{
childPeers
.
remove
(
child
);
}
...
...
@@ -74,7 +67,8 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
}
// Used by LWComponentPeer.setZOrder()
void
setChildPeerZOrder
(
LWComponentPeer
peer
,
LWComponentPeer
above
)
{
final
void
setChildPeerZOrder
(
final
LWComponentPeer
<?,
?>
peer
,
final
LWComponentPeer
<?,
?>
above
)
{
synchronized
(
getPeerTreeLock
())
{
childPeers
.
remove
(
peer
);
int
index
=
(
above
!=
null
)
?
childPeers
.
indexOf
(
above
)
:
childPeers
.
size
();
...
...
@@ -98,25 +92,27 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
}
@Override
public
void
beginValidate
()
{
public
final
void
beginValidate
()
{
// TODO: it seems that begin/endValidate() is only useful
// for heavyweight windows, when a batch movement for
// child windows occurs. That's why no-op
}
@Override
public
void
endValidate
()
{
public
final
void
endValidate
()
{
// TODO: it seems that begin/endValidate() is only useful
// for heavyweight windows, when a batch movement for
// child windows occurs. That's why no-op
}
@Override
public
void
beginLayout
()
{
public
final
void
beginLayout
()
{
// Skip all painting till endLayout()
setLayouting
(
true
);
}
@Override
public
void
endLayout
()
{
public
final
void
endLayout
()
{
setLayouting
(
false
);
// Post an empty event to flush all the pending target paints
...
...
@@ -125,18 +121,19 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
// ---- PEER NOTIFICATIONS ---- //
/*
/*
*
* Returns a copy of the childPeer collection.
*/
protected
List
<
LWComponentPeer
>
getChildren
()
{
@SuppressWarnings
(
"unchecked"
)
final
List
<
LWComponentPeer
<?,
?>>
getChildren
()
{
synchronized
(
getPeerTreeLock
())
{
Object
copy
=
((
LinkedList
)
childPeers
).
clone
();
return
(
List
<
LWComponentPeer
>)
copy
;
Object
copy
=
((
LinkedList
<?>)
childPeers
).
clone
();
return
(
List
<
LWComponentPeer
<?,
?>>)
copy
;
}
}
@Override
public
final
Region
getVisibleRegion
()
{
final
Region
getVisibleRegion
()
{
return
cutChildren
(
super
.
getVisibleRegion
(),
null
);
}
...
...
@@ -144,9 +141,9 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
* Removes bounds of children above specific child from the region. If above
* is null removes all bounds of children.
*/
protected
final
Region
cutChildren
(
Region
r
,
final
LWComponentPeer
above
)
{
final
Region
cutChildren
(
Region
r
,
final
LWComponentPeer
<?,
?>
above
)
{
boolean
aboveFound
=
above
==
null
;
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
if
(!
aboveFound
&&
child
==
above
)
{
aboveFound
=
true
;
continue
;
...
...
@@ -170,8 +167,8 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
* specified relative to the peer's parent.
*/
@Override
public
final
LWComponentPeer
findPeerAt
(
int
x
,
int
y
)
{
LWComponentPeer
peer
=
super
.
findPeerAt
(
x
,
y
);
final
LWComponentPeer
<?,
?>
findPeerAt
(
int
x
,
int
y
)
{
LWComponentPeer
<?,
?>
peer
=
super
.
findPeerAt
(
x
,
y
);
final
Rectangle
r
=
getBounds
();
// Translate to this container's coordinates to pass to children
x
-=
r
.
x
;
...
...
@@ -179,7 +176,7 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
if
(
peer
!=
null
&&
getContentSize
().
contains
(
x
,
y
))
{
synchronized
(
getPeerTreeLock
())
{
for
(
int
i
=
childPeers
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
LWComponentPeer
p
=
childPeers
.
get
(
i
).
findPeerAt
(
x
,
y
);
LWComponentPeer
<?,
?>
p
=
childPeers
.
get
(
i
).
findPeerAt
(
x
,
y
);
if
(
p
!=
null
)
{
peer
=
p
;
break
;
...
...
@@ -195,7 +192,7 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
* peers should be repainted
*/
@Override
public
final
void
repaintPeer
(
final
Rectangle
r
)
{
final
void
repaintPeer
(
final
Rectangle
r
)
{
final
Rectangle
toPaint
=
getSize
().
intersection
(
r
);
if
(!
isShowing
()
||
toPaint
.
isEmpty
())
{
return
;
...
...
@@ -208,13 +205,13 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
repaintChildren
(
toPaint
);
}
/*
/*
*
* Paints all the child peers in the straight z-order, so the
* bottom-most ones are painted first.
*/
private
void
repaintChildren
(
final
Rectangle
r
)
{
final
Rectangle
content
=
getContentSize
();
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
final
Rectangle
childBounds
=
child
.
getBounds
();
Rectangle
toPaint
=
r
.
intersection
(
childBounds
);
toPaint
=
toPaint
.
intersection
(
content
);
...
...
@@ -223,21 +220,21 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
}
}
protected
Rectangle
getContentSize
()
{
Rectangle
getContentSize
()
{
return
getSize
();
}
@Override
public
void
setEnabled
(
final
boolean
e
)
{
super
.
setEnabled
(
e
);
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
child
.
setEnabled
(
e
&&
child
.
getTarget
().
isEnabled
());
}
}
@Override
public
void
setBackground
(
final
Color
c
)
{
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
if
(!
child
.
getTarget
().
isBackgroundSet
())
{
child
.
setBackground
(
c
);
}
...
...
@@ -247,7 +244,7 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
@Override
public
void
setForeground
(
final
Color
c
)
{
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
if
(!
child
.
getTarget
().
isForegroundSet
())
{
child
.
setForeground
(
c
);
}
...
...
@@ -257,7 +254,7 @@ abstract class LWContainerPeer<T extends Container, D extends JComponent>
@Override
public
void
setFont
(
final
Font
f
)
{
for
(
final
LWComponentPeer
child
:
getChildren
())
{
for
(
final
LWComponentPeer
<?,
?>
child
:
getChildren
())
{
if
(!
child
.
getTarget
().
isFontSet
())
{
child
.
setFont
(
f
);
}
...
...
src/macosx/classes/sun/lwawt/LWCursorManager.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -32,6 +32,7 @@ import java.awt.Point;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
sun.awt.AWTAccessor
;
import
sun.awt.SunToolkit
;
public
abstract
class
LWCursorManager
{
...
...
@@ -109,7 +110,8 @@ public abstract class LWCursorManager {
cursorPos
.
y
-
p
.
y
);
}
while
(
c
!=
null
)
{
if
(
c
.
isVisible
()
&&
c
.
isEnabled
()
&&
(
c
.
getPeer
()
!=
null
))
{
final
Object
p
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
c
);
if
(
c
.
isVisible
()
&&
c
.
isEnabled
()
&&
p
!=
null
)
{
break
;
}
c
=
c
.
getParent
();
...
...
src/macosx/classes/sun/lwawt/LWLabelPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -44,7 +44,7 @@ final class LWLabelPeer extends LWComponentPeer<Label, JLabel>
}
@Override
protected
JLabel
createDelegate
()
{
JLabel
createDelegate
()
{
return
new
JLabel
();
}
...
...
src/macosx/classes/sun/lwawt/LWListPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -33,7 +33,8 @@ import java.awt.peer.ListPeer;
import
java.util.Arrays
;
/**
* Lightweight implementation of {@link ListPeer}.
* Lightweight implementation of {@link ListPeer}. Delegates most of the work to
* the {@link JList}, which is placed inside {@link JScrollPane}.
*/
final
class
LWListPeer
extends
LWComponentPeer
<
List
,
LWListPeer
.
ScrollableJList
>
implements
ListPeer
{
...
...
@@ -56,7 +57,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
@Override
protected
ScrollableJList
createDelegate
()
{
ScrollableJList
createDelegate
()
{
return
new
ScrollableJList
();
}
...
...
@@ -78,7 +79,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
@Override
protected
Component
getDelegateFocusOwner
()
{
Component
getDelegateFocusOwner
()
{
return
getDelegate
().
getView
();
}
...
...
@@ -193,6 +194,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
}
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
final
class
ScrollableJList
extends
JScrollPane
implements
ListSelectionListener
{
private
boolean
skipStateChangedEvent
;
...
...
@@ -234,9 +236,10 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
valueChanged
(
final
ListSelectionEvent
e
)
{
if
(!
e
.
getValueIsAdjusting
()
&&
!
isSkipStateChangedEvent
())
{
final
JList
source
=
(
JList
)
e
.
getSource
();
final
JList
<?>
source
=
(
JList
<?>
)
e
.
getSource
();
for
(
int
i
=
0
;
i
<
source
.
getModel
().
getSize
();
i
++)
{
final
boolean
wasSelected
=
Arrays
.
binarySearch
(
oldSelectedIndices
,
i
)
>=
0
;
...
...
@@ -255,6 +258,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
}
@SuppressWarnings
(
"unchecked"
)
public
JList
<
String
>
getView
()
{
return
(
JList
<
String
>)
getViewport
().
getView
();
}
...
...
@@ -289,7 +293,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
private
final
class
JListDelegate
extends
JList
<
String
>
{
JListDelegate
()
{
super
(
ScrollableJList
.
this
.
model
);
super
(
model
);
}
@Override
...
...
src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -30,10 +30,9 @@ import java.awt.Window;
import
java.awt.peer.MouseInfoPeer
;
public
class
LWMouseInfoPeer
implements
MouseInfoPeer
{
import
sun.awt.AWTAccessor
;
public
LWMouseInfoPeer
()
{
}
public
class
LWMouseInfoPeer
implements
MouseInfoPeer
{
@Override
public
int
fillPointWithCoords
(
Point
point
)
{
...
...
@@ -52,7 +51,7 @@ public class LWMouseInfoPeer implements MouseInfoPeer {
return
false
;
}
LWWindowPeer
windowPeer
=
(
LWWindowPeer
)
w
.
getPeer
(
);
final
Object
windowPeer
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
return
LWWindowPeer
.
getWindowUnderCursor
()
==
windowPeer
;
}
...
...
src/macosx/classes/sun/lwawt/LWPanelPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -31,6 +31,10 @@ import java.awt.peer.PanelPeer;
import
javax.swing.JPanel
;
/**
* Lightweight implementation of {@link PanelPeer}. Delegates most of the work
* to the {@link JPanel}.
*/
final
class
LWPanelPeer
extends
LWContainerPeer
<
Panel
,
JPanel
>
implements
PanelPeer
{
...
...
@@ -39,7 +43,7 @@ final class LWPanelPeer extends LWContainerPeer<Panel, JPanel>
}
@Override
public
JPanel
createDelegate
()
{
JPanel
createDelegate
()
{
return
new
JPanel
();
}
}
src/macosx/classes/sun/lwawt/LWRepaintArea.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -26,39 +26,38 @@
package
sun.lwawt
;
import
sun.awt.RepaintArea
;
import
java.awt.Component
;
import
java.awt.Graphics
;
import
sun.awt.AWTAccessor
;
import
sun.awt.RepaintArea
;
/**
* Emulates appearance of heavyweight components before call of the user code.
*
* @author Sergey Bylokhov
*/
final
class
LWRepaintArea
extends
RepaintArea
{
@Override
protected
void
updateComponent
(
final
Component
comp
,
final
Graphics
g
)
{
// We shouldn't paint native component as a result of UPDATE events,
// just flush onscreen back-buffer.
if
(
comp
!=
null
)
{
super
.
updateComponent
(
comp
,
g
);
flushBuffers
((
LWComponentPeer
)
comp
.
getPeer
()
);
LWComponentPeer
.
flushOnscreenGraphics
(
);
}
}
@Override
protected
void
paintComponent
(
final
Component
comp
,
final
Graphics
g
)
{
if
(
comp
!=
null
)
{
final
LWComponentPeer
peer
=
(
LWComponentPeer
)
comp
.
getPeer
(
);
Object
peer
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
comp
);
if
(
peer
!=
null
)
{
peer
.
paintPeer
(
g
);
((
LWComponentPeer
<?,
?>)
peer
)
.
paintPeer
(
g
);
}
super
.
paintComponent
(
comp
,
g
);
flushBuffers
(
peer
);
}
}
private
static
void
flushBuffers
(
final
LWComponentPeer
peer
)
{
if
(
peer
!=
null
)
{
peer
.
flushOnscreenGraphics
();
LWComponentPeer
.
flushOnscreenGraphics
();
}
}
}
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
浏览文件 @
f1f03a8c
...
...
@@ -34,10 +34,14 @@ import java.awt.peer.ScrollbarPeer;
import
javax.swing.JScrollBar
;
/**
* Lightweight implementation of {@link ScrollbarPeer}. Delegates most of the
* work to the {@link JScrollBar}.
*/
final
class
LWScrollBarPeer
extends
LWComponentPeer
<
Scrollbar
,
JScrollBar
>
implements
ScrollbarPeer
,
AdjustmentListener
{
//JScrollBar fires two changes with firePropertyChange (one for old value
//
JScrollBar fires two changes with firePropertyChange (one for old value
// and one for new one.
// We save the last value and don't fire event if not changed.
private
int
currentValue
;
...
...
@@ -48,7 +52,7 @@ final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar>
}
@Override
protected
JScrollBar
createDelegate
()
{
JScrollBar
createDelegate
()
{
return
new
JScrollBar
();
}
...
...
src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -33,6 +33,10 @@ import java.awt.event.MouseWheelEvent;
import
java.awt.peer.ScrollPanePeer
;
import
java.util.List
;
/**
* Lightweight implementation of {@link ScrollPanePeer}. Delegates most of the
* work to the {@link JScrollPane}.
*/
final
class
LWScrollPanePeer
extends
LWContainerPeer
<
ScrollPane
,
JScrollPane
>
implements
ScrollPanePeer
,
ChangeListener
{
...
...
@@ -41,7 +45,8 @@ final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
super
(
target
,
platformComponent
);
}
protected
JScrollPane
createDelegate
()
{
@Override
JScrollPane
createDelegate
()
{
final
JScrollPane
sp
=
new
JScrollPane
();
final
JPanel
panel
=
new
JPanel
();
panel
.
setOpaque
(
false
);
...
...
@@ -72,7 +77,7 @@ final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
LWComponentPeer
viewPeer
=
getViewPeer
();
final
LWComponentPeer
<?,
?>
viewPeer
=
getViewPeer
();
if
(
viewPeer
!=
null
)
{
final
Rectangle
r
;
synchronized
(
getDelegateLock
())
{
...
...
@@ -96,14 +101,13 @@ final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
}
}
LWComponentPeer
getViewPeer
()
{
List
<
LWComponentPeer
>
peerList
=
getChildren
();
LWComponentPeer
<?,
?>
getViewPeer
()
{
final
List
<
LWComponentPeer
<?,
?>
>
peerList
=
getChildren
();
return
peerList
.
isEmpty
()
?
null
:
peerList
.
get
(
0
);
}
@Override
protected
Rectangle
getContentSize
()
{
Rectangle
getContentSize
()
{
Rectangle
viewRect
=
getDelegate
().
getViewport
().
getViewRect
();
return
new
Rectangle
(
viewRect
.
width
,
viewRect
.
height
);
}
...
...
@@ -112,7 +116,7 @@ final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
public
void
layout
()
{
super
.
layout
();
synchronized
(
getDelegateLock
())
{
LWComponentPeer
viewPeer
=
getViewPeer
();
final
LWComponentPeer
<?,
?>
viewPeer
=
getViewPeer
();
if
(
viewPeer
!=
null
)
{
Component
view
=
getDelegate
().
getViewport
().
getView
();
view
.
setBounds
(
viewPeer
.
getBounds
());
...
...
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -44,7 +44,7 @@ import javax.swing.text.JTextComponent;
/**
* Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
* work to the {@link JTextArea} inside
JScrollPane
.
* work to the {@link JTextArea} inside
{@link JScrollPane}
.
*/
final
class
LWTextAreaPeer
extends
LWTextComponentPeer
<
TextArea
,
LWTextAreaPeer
.
ScrollableJTextArea
>
...
...
@@ -66,7 +66,7 @@ final class LWTextAreaPeer
}
@Override
protected
ScrollableJTextArea
createDelegate
()
{
ScrollableJTextArea
createDelegate
()
{
return
new
ScrollableJTextArea
();
}
...
...
@@ -85,7 +85,7 @@ final class LWTextAreaPeer
}
@Override
protected
Cursor
getCursor
(
final
Point
p
)
{
Cursor
getCursor
(
final
Point
p
)
{
final
boolean
isContains
;
synchronized
(
getDelegateLock
())
{
isContains
=
getDelegate
().
getViewport
().
getBounds
().
contains
(
p
);
...
...
@@ -94,7 +94,7 @@ final class LWTextAreaPeer
}
@Override
protected
Component
getDelegateFocusOwner
()
{
Component
getDelegateFocusOwner
()
{
return
getTextComponent
();
}
...
...
@@ -200,7 +200,7 @@ final class LWTextAreaPeer
}
}
@SuppressWarnings
(
"serial"
)
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
final
class
ScrollableJTextArea
extends
JScrollPane
{
ScrollableJTextArea
()
{
...
...
@@ -218,7 +218,6 @@ final class LWTextAreaPeer
super
.
setEnabled
(
enabled
);
}
@SuppressWarnings
(
"serial"
)
private
final
class
JTextAreaDelegate
extends
JTextArea
{
// Empty non private constructor was added because access to this
...
...
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -44,11 +44,14 @@ import javax.swing.event.DocumentListener;
import
javax.swing.text.Document
;
import
javax.swing.text.JTextComponent
;
/**
* Lightweight implementation of {@link TextComponentPeer}. Provides useful
* methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer}
*/
abstract
class
LWTextComponentPeer
<
T
extends
TextComponent
,
D
extends
JComponent
>
extends
LWComponentPeer
<
T
,
D
>
implements
DocumentListener
,
TextComponentPeer
,
InputMethodListener
{
private
volatile
boolean
firstChangeSkipped
;
LWTextComponentPeer
(
final
T
target
,
...
...
@@ -218,14 +221,14 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
}
@Override
public
void
inputMethodTextChanged
(
InputMethodEvent
event
)
{
public
void
inputMethodTextChanged
(
final
InputMethodEvent
event
)
{
synchronized
(
getDelegateLock
())
{
AWTAccessor
.
getComponentAccessor
().
processEvent
(
getTextComponent
(),
event
);
}
}
@Override
public
void
caretPositionChanged
(
InputMethodEvent
event
)
{
public
void
caretPositionChanged
(
final
InputMethodEvent
event
)
{
synchronized
(
getDelegateLock
())
{
AWTAccessor
.
getComponentAccessor
().
processEvent
(
getTextComponent
(),
event
);
}
...
...
src/macosx/classes/sun/lwawt/LWTextFieldPeer.java
浏览文件 @
f1f03a8c
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -37,6 +37,10 @@ import java.awt.peer.TextFieldPeer;
import
javax.swing.*
;
import
javax.swing.text.JTextComponent
;
/**
* Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
* work to the {@link JPasswordField}.
*/
final
class
LWTextFieldPeer
extends
LWTextComponentPeer
<
TextField
,
JPasswordField
>
implements
TextFieldPeer
,
ActionListener
{
...
...
@@ -47,7 +51,7 @@ final class LWTextFieldPeer
}
@Override
protected
JPasswordField
createDelegate
()
{
JPasswordField
createDelegate
()
{
return
new
JPasswordFieldDelegate
();
}
...
...
@@ -107,7 +111,7 @@ final class LWTextFieldPeer
* @param e the focus event
*/
@Override
protected
void
handleJavaFocusEvent
(
final
FocusEvent
e
)
{
void
handleJavaFocusEvent
(
final
FocusEvent
e
)
{
if
(
e
.
getID
()
==
FocusEvent
.
FOCUS_LOST
)
{
// In order to de-select the selection
setCaretPosition
(
0
);
...
...
@@ -115,6 +119,7 @@ final class LWTextFieldPeer
super
.
handleJavaFocusEvent
(
e
);
}
@SuppressWarnings
(
"serial"
)
// Safe: outer class is non-serializable.
private
final
class
JPasswordFieldDelegate
extends
JPasswordField
{
// Empty non private constructor was added because access to this
...
...
src/macosx/classes/sun/lwawt/LWToolkit.java
浏览文件 @
f1f03a8c
...
...
@@ -557,16 +557,18 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
}
@Override
public
void
grab
(
Window
w
)
{
if
(
w
.
getPeer
()
!=
null
)
{
((
LWWindowPeer
)
w
.
getPeer
()).
grab
();
public
void
grab
(
final
Window
w
)
{
final
Object
peer
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
if
(
peer
!=
null
)
{
((
LWWindowPeer
)
peer
).
grab
();
}
}
@Override
public
void
ungrab
(
Window
w
)
{
if
(
w
.
getPeer
()
!=
null
)
{
((
LWWindowPeer
)
w
.
getPeer
()).
ungrab
(
false
);
public
void
ungrab
(
final
Window
w
)
{
final
Object
peer
=
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
if
(
peer
!=
null
)
{
((
LWWindowPeer
)
peer
).
ungrab
(
false
);
}
}
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
f1f03a8c
...
...
@@ -43,7 +43,7 @@ public class LWWindowPeer
extends
LWContainerPeer
<
Window
,
JComponent
>
implements
FramePeer
,
DialogPeer
,
FullScreenCapable
,
DisplayChangedListener
,
PlatformEventNotifier
{
public
static
enum
PeerType
{
public
enum
PeerType
{
SIMPLEWINDOW
,
FRAME
,
DIALOG
,
...
...
@@ -83,15 +83,15 @@ public class LWWindowPeer
// A peer where the last mouse event came to. Used by cursor manager to
// find the component under cursor
private
static
volatile
LWComponentPeer
lastCommonMouseEventPeer
=
null
;
private
static
volatile
LWComponentPeer
<?,
?>
lastCommonMouseEventPeer
;
// A peer where the last mouse event came to. Used to generate
// MOUSE_ENTERED/EXITED notifications
private
volatile
LWComponentPeer
lastMouseEventPeer
;
private
volatile
LWComponentPeer
<?,
?>
lastMouseEventPeer
;
// Peers where all dragged/released events should come to,
// depending on what mouse button is being dragged according to Cocoa
private
static
LWComponentPeer
mouseDownTarget
[]
=
new
LWComponentPeer
[
3
];
private
static
final
LWComponentPeer
<?,
?>[]
mouseDownTarget
=
new
LWComponentPeer
<?,
?>
[
3
];
// A bitmask that indicates what mouse buttons produce MOUSE_CLICKED events
// on MOUSE_RELEASE. Click events are only generated if there were no drag
...
...
@@ -129,7 +129,8 @@ public class LWWindowPeer
this
.
peerType
=
peerType
;
Window
owner
=
target
.
getOwner
();
LWWindowPeer
ownerPeer
=
(
owner
!=
null
)
?
(
LWWindowPeer
)
owner
.
getPeer
()
:
null
;
LWWindowPeer
ownerPeer
=
owner
==
null
?
null
:
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
owner
);
PlatformWindow
ownerDelegate
=
(
ownerPeer
!=
null
)
?
ownerPeer
.
getPlatformWindow
()
:
null
;
// The delegate.initialize() needs a non-null GC on X11.
...
...
@@ -163,10 +164,10 @@ public class LWWindowPeer
// Init warning window(for applets)
SecurityWarningWindow
warn
=
null
;
if
(
((
Window
)
target
)
.
getWarningString
()
!=
null
)
{
if
(
target
.
getWarningString
()
!=
null
)
{
// accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
// and TrayIcon balloon windows without a warning window.
if
(!
AWTAccessor
.
getWindowAccessor
().
isTrayIconWindow
(
(
Window
)
target
))
{
if
(!
AWTAccessor
.
getWindowAccessor
().
isTrayIconWindow
(
target
))
{
LWToolkit
toolkit
=
(
LWToolkit
)
Toolkit
.
getDefaultToolkit
();
warn
=
toolkit
.
createSecurityWarning
(
target
,
this
);
}
...
...
@@ -210,6 +211,7 @@ public class LWWindowPeer
}
// Just a helper method
@Override
public
PlatformWindow
getPlatformWindow
()
{
return
platformWindow
;
}
...
...
@@ -391,7 +393,8 @@ public class LWWindowPeer
@Override
public
void
setModalBlocked
(
Dialog
blocker
,
boolean
blocked
)
{
synchronized
(
getPeerTreeLock
())
{
this
.
blocker
=
blocked
?
(
LWWindowPeer
)
blocker
.
getPeer
()
:
null
;
this
.
blocker
=
!
blocked
?
null
:
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
blocker
);
}
platformWindow
.
setModalBlocked
(
blocked
);
...
...
@@ -458,6 +461,7 @@ public class LWWindowPeer
textured
=
isTextured
;
}
@Override
public
final
boolean
isTranslucent
()
{
synchronized
(
getStateLock
())
{
/*
...
...
@@ -537,7 +541,8 @@ public class LWWindowPeer
public
void
blockWindows
(
List
<
Window
>
windows
)
{
//TODO: LWX will probably need some collectJavaToplevels to speed this up
for
(
Window
w
:
windows
)
{
WindowPeer
wp
=
(
WindowPeer
)
w
.
getPeer
();
WindowPeer
wp
=
(
WindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
w
);
if
(
wp
!=
null
)
{
wp
.
setModalBlocked
((
Dialog
)
getTarget
(),
true
);
}
...
...
@@ -694,7 +699,7 @@ public class LWWindowPeer
// TODO: fill "bdata" member of AWTEvent
Rectangle
r
=
getBounds
();
// findPeerAt() expects parent coordinates
LWComponentPeer
targetPeer
=
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
);
LWComponentPeer
<?,
?>
targetPeer
=
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
);
if
(
id
==
MouseEvent
.
MOUSE_EXITED
)
{
isMouseOver
=
false
;
...
...
@@ -743,7 +748,7 @@ public class LWWindowPeer
screenX
,
screenY
,
modifiers
,
clickCount
,
popupTrigger
,
targetPeer
);
}
else
{
LWComponentPeer
topmostTargetPeer
=
LWComponentPeer
<?,
?>
topmostTargetPeer
=
topmostWindowPeer
!=
null
?
topmostWindowPeer
.
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
)
:
null
;
topmostWindowPeer
.
generateMouseEnterExitEventsForComponents
(
when
,
button
,
x
,
y
,
screenX
,
screenY
,
modifiers
,
clickCount
,
popupTrigger
,
...
...
@@ -840,7 +845,7 @@ public class LWWindowPeer
private
void
generateMouseEnterExitEventsForComponents
(
long
when
,
int
button
,
int
x
,
int
y
,
int
screenX
,
int
screenY
,
int
modifiers
,
int
clickCount
,
boolean
popupTrigger
,
LWComponentPeer
targetPeer
)
{
final
LWComponentPeer
<?,
?>
targetPeer
)
{
if
(!
isMouseOver
||
targetPeer
==
lastMouseEventPeer
)
{
return
;
...
...
@@ -899,7 +904,7 @@ public class LWWindowPeer
// TODO: could we just use the last mouse event target here?
Rectangle
r
=
getBounds
();
// findPeerAt() expects parent coordinates
final
LWComponentPeer
targetPeer
=
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
);
final
LWComponentPeer
<?,
?>
targetPeer
=
findPeerAt
(
r
.
x
+
x
,
r
.
y
+
y
);
if
(
targetPeer
==
null
||
!
targetPeer
.
isEnabled
())
{
return
;
}
...
...
@@ -1157,8 +1162,9 @@ public class LWWindowPeer
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
Level
.
FINE
))
{
focusLog
.
fine
(
"requesting native focus to the owner "
+
owner
);
}
LWWindowPeer
currentActivePeer
=
(
currentActive
!=
null
?
(
LWWindowPeer
)
currentActive
.
getPeer
()
:
null
);
LWWindowPeer
currentActivePeer
=
currentActive
==
null
?
null
:
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
currentActive
);
// Ensure the opposite is natively active and suppress sending events.
if
(
currentActivePeer
!=
null
&&
currentActivePeer
.
platformWindow
.
isActive
())
{
...
...
@@ -1270,7 +1276,8 @@ public class LWWindowPeer
while
(
owner
!=
null
&&
!(
owner
instanceof
Frame
||
owner
instanceof
Dialog
))
{
owner
=
owner
.
getOwner
();
}
return
owner
!=
null
?
(
LWWindowPeer
)
owner
.
getPeer
()
:
null
;
return
owner
==
null
?
null
:
(
LWWindowPeer
)
AWTAccessor
.
getComponentAccessor
().
getPeer
(
owner
);
}
/**
...
...
@@ -1289,11 +1296,13 @@ public class LWWindowPeer
}
}
@Override
public
void
enterFullScreenMode
()
{
platformWindow
.
enterFullScreenMode
();
updateSecurityWarningVisibility
();
}
@Override
public
void
exitFullScreenMode
()
{
platformWindow
.
exitFullScreenMode
();
updateSecurityWarningVisibility
();
...
...
src/macosx/classes/sun/lwawt/SelectionClearListener.java
已删除
100644 → 0
浏览文件 @
a460ab1d
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
sun.lwawt
;
/*
* Every time the TextField (or TextArea) change selection, every other text components
* must immediately clear their selections.
*/
interface
SelectionClearListener
{
void
clearSelection
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录