Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
961b7f16
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
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看板
提交
961b7f16
编写于
7月 08, 2008
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
Reviewed-by: peterz, loneid
上级
c684d359
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
172 addition
and
22 deletion
+172
-22
src/share/classes/java/beans/MetaData.java
src/share/classes/java/beans/MetaData.java
+32
-22
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
+82
-0
test/java/beans/XMLEncoder/java_awt_Component.java
test/java/beans/XMLEncoder/java_awt_Component.java
+58
-0
未找到文件。
src/share/classes/java/beans/MetaData.java
浏览文件 @
961b7f16
...
...
@@ -986,14 +986,20 @@ class java_awt_Component_PersistenceDelegate extends DefaultPersistenceDelegate
// null to defined values after the Windows are made visible -
// special case them for now.
if
(!(
oldInstance
instanceof
java
.
awt
.
Window
))
{
String
[]
fieldNames
=
new
String
[]{
"background"
,
"foreground"
,
"font"
};
for
(
int
i
=
0
;
i
<
fieldNames
.
length
;
i
++)
{
String
name
=
fieldNames
[
i
];
Object
oldValue
=
ReflectionUtils
.
getPrivateField
(
oldInstance
,
java
.
awt
.
Component
.
class
,
name
,
out
.
getExceptionListener
());
Object
newValue
=
(
newInstance
==
null
)
?
null
:
ReflectionUtils
.
getPrivateField
(
newInstance
,
java
.
awt
.
Component
.
class
,
name
,
out
.
getExceptionListener
());
if
(
oldValue
!=
null
&&
!
oldValue
.
equals
(
newValue
))
{
invokeStatement
(
oldInstance
,
"set"
+
NameGenerator
.
capitalize
(
name
),
new
Object
[]{
oldValue
},
out
);
}
Object
oldBackground
=
c
.
isBackgroundSet
()
?
c
.
getBackground
()
:
null
;
Object
newBackground
=
c2
.
isBackgroundSet
()
?
c2
.
getBackground
()
:
null
;
if
(!
MetaData
.
equals
(
oldBackground
,
newBackground
))
{
invokeStatement
(
oldInstance
,
"setBackground"
,
new
Object
[]
{
oldBackground
},
out
);
}
Object
oldForeground
=
c
.
isForegroundSet
()
?
c
.
getForeground
()
:
null
;
Object
newForeground
=
c2
.
isForegroundSet
()
?
c2
.
getForeground
()
:
null
;
if
(!
MetaData
.
equals
(
oldForeground
,
newForeground
))
{
invokeStatement
(
oldInstance
,
"setForeground"
,
new
Object
[]
{
oldForeground
},
out
);
}
Object
oldFont
=
c
.
isFontSet
()
?
c
.
getFont
()
:
null
;
Object
newFont
=
c2
.
isFontSet
()
?
c2
.
getFont
()
:
null
;
if
(!
MetaData
.
equals
(
oldFont
,
newFont
))
{
invokeStatement
(
oldInstance
,
"setFont"
,
new
Object
[]
{
oldFont
},
out
);
}
}
...
...
@@ -1104,26 +1110,30 @@ class java_awt_List_PersistenceDelegate extends DefaultPersistenceDelegate {
// BorderLayout
class
java_awt_BorderLayout_PersistenceDelegate
extends
DefaultPersistenceDelegate
{
private
static
final
String
[]
CONSTRAINTS
=
{
BorderLayout
.
NORTH
,
BorderLayout
.
SOUTH
,
BorderLayout
.
EAST
,
BorderLayout
.
WEST
,
BorderLayout
.
CENTER
,
BorderLayout
.
PAGE_START
,
BorderLayout
.
PAGE_END
,
BorderLayout
.
LINE_START
,
BorderLayout
.
LINE_END
,
};
@Override
protected
void
initialize
(
Class
<?>
type
,
Object
oldInstance
,
Object
newInstance
,
Encoder
out
)
{
super
.
initialize
(
type
,
oldInstance
,
newInstance
,
out
);
String
[]
locations
=
{
"north"
,
"south"
,
"east"
,
"west"
,
"center"
};
String
[]
names
=
{
java
.
awt
.
BorderLayout
.
NORTH
,
java
.
awt
.
BorderLayout
.
SOUTH
,
java
.
awt
.
BorderLayout
.
EAST
,
java
.
awt
.
BorderLayout
.
WEST
,
java
.
awt
.
BorderLayout
.
CENTER
};
for
(
int
i
=
0
;
i
<
locations
.
length
;
i
++)
{
Object
oldC
=
ReflectionUtils
.
getPrivateField
(
oldInstance
,
java
.
awt
.
BorderLayout
.
class
,
locations
[
i
],
out
.
getExceptionListener
());
Object
newC
=
ReflectionUtils
.
getPrivateField
(
newInstance
,
java
.
awt
.
BorderLayout
.
class
,
locations
[
i
],
out
.
getExceptionListener
());
BorderLayout
oldLayout
=
(
BorderLayout
)
oldInstance
;
BorderLayout
newLayout
=
(
BorderLayout
)
newInstance
;
for
(
String
constraints
:
CONSTRAINTS
)
{
Object
oldC
=
oldLayout
.
getLayoutComponent
(
constraints
);
Object
newC
=
newLayout
.
getLayoutComponent
(
constraints
);
// Pending, assume any existing elements are OK.
if
(
oldC
!=
null
&&
newC
==
null
)
{
invokeStatement
(
oldInstance
,
"addLayoutComponent"
,
new
Object
[]
{
oldC
,
names
[
i
]
},
out
);
new
Object
[]
{
oldC
,
constraints
},
out
);
}
}
}
...
...
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
0 → 100644
浏览文件 @
961b7f16
/*
* Copyright 2008 Sun Microsystems, Inc. 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.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4916852
* @summary Tests BorderLayout encoding
* @author Sergey Malenkov
*/
import
java.awt.BorderLayout
;
import
javax.swing.JLabel
;
public
final
class
java_awt_BorderLayout
extends
AbstractTest
<
BorderLayout
>
{
private
static
final
String
[]
CONSTRAINTS
=
{
BorderLayout
.
NORTH
,
BorderLayout
.
SOUTH
,
BorderLayout
.
EAST
,
BorderLayout
.
WEST
,
BorderLayout
.
CENTER
,
BorderLayout
.
PAGE_START
,
BorderLayout
.
PAGE_END
,
BorderLayout
.
LINE_START
,
BorderLayout
.
LINE_END
,
};
public
static
void
main
(
String
[]
args
)
{
new
java_awt_BorderLayout
().
test
(
true
);
}
@Override
protected
BorderLayout
getObject
()
{
BorderLayout
layout
=
new
BorderLayout
();
update
(
layout
,
BorderLayout
.
EAST
);
update
(
layout
,
BorderLayout
.
WEST
);
update
(
layout
,
BorderLayout
.
NORTH
);
update
(
layout
,
BorderLayout
.
SOUTH
);
return
layout
;
}
@Override
protected
BorderLayout
getAnotherObject
()
{
BorderLayout
layout
=
getObject
();
update
(
layout
,
BorderLayout
.
CENTER
);
return
layout
;
}
@Override
protected
void
validate
(
BorderLayout
before
,
BorderLayout
after
)
{
super
.
validate
(
before
,
after
);
BeanValidator
validator
=
new
BeanValidator
();
for
(
String
constraint
:
CONSTRAINTS
)
{
validator
.
validate
(
before
.
getLayoutComponent
(
constraint
),
after
.
getLayoutComponent
(
constraint
));
}
}
private
static
void
update
(
BorderLayout
layout
,
String
constraints
)
{
layout
.
addLayoutComponent
(
new
JLabel
(
constraints
),
constraints
);
}
}
test/java/beans/XMLEncoder/java_awt_Component.java
0 → 100644
浏览文件 @
961b7f16
/*
* Copyright 2008 Sun Microsystems, Inc. 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.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4916852
* @summary Tests Component encoding (background, foreground and font)
* @author Sergey Malenkov
*/
import
java.awt.Color
;
import
java.awt.Component
;
import
java.awt.Font
;
public
final
class
java_awt_Component
extends
AbstractTest
<
Component
>
{
public
static
void
main
(
String
[]
args
)
{
new
java_awt_Component
().
test
(
true
);
}
@Override
protected
Component
getObject
()
{
Component
component
=
new
MyComponent
();
component
.
setBackground
(
Color
.
WHITE
);
component
.
setFont
(
new
Font
(
null
,
Font
.
BOLD
,
5
));
return
component
;
}
@Override
protected
Component
getAnotherObject
()
{
Component
component
=
new
MyComponent
();
component
.
setForeground
(
Color
.
BLACK
);
component
.
setFont
(
new
Font
(
null
,
Font
.
ITALIC
,
6
));
return
component
;
}
public
static
final
class
MyComponent
extends
Component
{
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录