Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
db17c56c
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看板
提交
db17c56c
编写于
3月 04, 2010
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
6b10b34a
c4a40797
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
1199 addition
and
73 deletion
+1199
-73
src/share/classes/java/beans/XMLEncoder.java
src/share/classes/java/beans/XMLEncoder.java
+35
-34
src/share/classes/javax/swing/JTable.java
src/share/classes/javax/swing/JTable.java
+2
-8
src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
...hare/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
+1
-0
src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
+2
-3
src/share/classes/javax/swing/text/DefaultEditorKit.java
src/share/classes/javax/swing/text/DefaultEditorKit.java
+25
-28
test/java/beans/XMLEncoder/Test5023550.java
test/java/beans/XMLEncoder/Test5023550.java
+122
-0
test/java/beans/XMLEncoder/Test5023557.java
test/java/beans/XMLEncoder/Test5023557.java
+99
-0
test/java/beans/XMLEncoder/Test6921644.java
test/java/beans/XMLEncoder/Test6921644.java
+197
-0
test/javax/swing/JEditorPane/6917744/bug6917744.java
test/javax/swing/JEditorPane/6917744/bug6917744.java
+113
-0
test/javax/swing/JEditorPane/6917744/test.html
test/javax/swing/JEditorPane/6917744/test.html
+494
-0
test/javax/swing/JScrollBar/6924059/bug6924059.java
test/javax/swing/JScrollBar/6924059/bug6924059.java
+56
-0
test/javax/swing/JTable/6913768/bug6913768.java
test/javax/swing/JTable/6913768/bug6913768.java
+53
-0
未找到文件。
src/share/classes/java/beans/XMLEncoder.java
浏览文件 @
db17c56c
/*
* Copyright 2000-20
06
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-20
10
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
...
...
@@ -214,8 +214,8 @@ public class XMLEncoder extends Encoder {
private
Object
owner
;
private
int
indentation
=
0
;
private
boolean
internal
=
false
;
private
Map
valueToExpression
;
private
Map
targetToStatementList
;
private
Map
<
Object
,
ValueData
>
valueToExpression
;
private
Map
<
Object
,
List
<
Statement
>>
targetToStatementList
;
private
boolean
preambleWritten
=
false
;
private
NameGenerator
nameGenerator
;
...
...
@@ -287,8 +287,8 @@ public class XMLEncoder extends Encoder {
this
.
declaration
=
declaration
;
this
.
indentation
=
indentation
;
this
.
out
=
new
OutputStreamWriter
(
out
,
cs
.
newEncoder
());
valueToExpression
=
new
IdentityHashMap
();
targetToStatementList
=
new
IdentityHashMap
();
valueToExpression
=
new
IdentityHashMap
<
Object
,
ValueData
>
();
targetToStatementList
=
new
IdentityHashMap
<
Object
,
List
<
Statement
>>
();
nameGenerator
=
new
NameGenerator
();
}
...
...
@@ -331,13 +331,12 @@ public class XMLEncoder extends Encoder {
}
}
private
Vector
statementList
(
Object
target
)
{
Vector
list
=
(
Vector
)
targetToStatementList
.
get
(
target
);
if
(
list
!=
null
)
{
return
list
;
private
List
<
Statement
>
statementList
(
Object
target
)
{
List
<
Statement
>
list
=
targetToStatementList
.
get
(
target
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<
Statement
>();
targetToStatementList
.
put
(
target
,
list
);
}
list
=
new
Vector
();
targetToStatementList
.
put
(
target
,
list
);
return
list
;
}
...
...
@@ -363,13 +362,13 @@ public class XMLEncoder extends Encoder {
}
d
.
marked
=
true
;
Object
target
=
exp
.
getTarget
();
mark
(
exp
);
if
(!(
target
instanceof
Class
))
{
statementList
(
target
).
add
(
exp
);
// Pending: Why does the reference count need to
// be incremented here?
d
.
refs
++;
}
mark
(
exp
);
}
private
void
mark
(
Statement
stm
)
{
...
...
@@ -463,9 +462,9 @@ public class XMLEncoder extends Encoder {
preambleWritten
=
true
;
}
indentation
++;
Vector
roo
ts
=
statementList
(
this
);
for
(
int
i
=
0
;
i
<
roots
.
size
();
i
++
)
{
Statement
s
=
(
Statement
)
roots
.
get
(
i
);
List
<
Statement
>
statemen
ts
=
statementList
(
this
);
while
(!
statements
.
isEmpty
()
)
{
Statement
s
=
statements
.
remove
(
0
);
if
(
"writeObject"
.
equals
(
s
.
getMethodName
()))
{
outputValue
(
s
.
getArguments
()[
0
],
this
,
true
);
}
...
...
@@ -513,7 +512,7 @@ public class XMLEncoder extends Encoder {
}
private
ValueData
getValueData
(
Object
o
)
{
ValueData
d
=
(
ValueData
)
valueToExpression
.
get
(
o
);
ValueData
d
=
valueToExpression
.
get
(
o
);
if
(
d
==
null
)
{
d
=
new
ValueData
();
valueToExpression
.
put
(
o
,
d
);
...
...
@@ -619,11 +618,11 @@ public class XMLEncoder extends Encoder {
}
if
(
d
.
name
!=
null
)
{
writeln
(
"<object idref="
+
quote
(
d
.
name
)
+
"/>"
);
return
;
outputXML
(
isArgument
?
"object"
:
"void"
,
" idref="
+
quote
(
d
.
name
),
value
);
}
else
if
(
d
.
exp
!=
null
)
{
outputStatement
(
d
.
exp
,
outer
,
isArgument
);
}
outputStatement
(
d
.
exp
,
outer
,
isArgument
);
}
private
static
String
quoteCharCode
(
int
code
)
{
...
...
@@ -683,13 +682,6 @@ public class XMLEncoder extends Encoder {
String
tag
=
(
expression
&&
isArgument
)
?
"object"
:
"void"
;
String
attributes
=
""
;
ValueData
d
=
getValueData
(
value
);
if
(
expression
)
{
if
(
d
.
refs
>
1
)
{
String
instanceName
=
nameGenerator
.
instanceName
(
value
);
d
.
name
=
instanceName
;
attributes
=
attributes
+
" id="
+
quote
(
instanceName
);
}
}
// Special cases for targets.
if
(
target
==
outer
)
{
...
...
@@ -706,13 +698,19 @@ public class XMLEncoder extends Encoder {
else
{
d
.
refs
=
2
;
getValueData
(
target
).
refs
++;
outputValue
(
target
,
outer
,
false
);
if
(
isArgument
)
{
outputValue
(
value
,
outer
,
false
);
List
<
Statement
>
statements
=
statementList
(
target
);
if
(
!
statements
.
contains
(
exp
)
)
{
statements
.
add
(
exp
);
}
outputValue
(
target
,
outer
,
false
);
outputValue
(
value
,
outer
,
isArgument
);
return
;
}
if
(
expression
&&
(
d
.
refs
>
1
))
{
String
instanceName
=
nameGenerator
.
instanceName
(
value
);
d
.
name
=
instanceName
;
attributes
=
attributes
+
" id="
+
quote
(
instanceName
);
}
// Special cases for methods.
if
((!
expression
&&
methodName
.
equals
(
"set"
)
&&
args
.
length
==
2
&&
...
...
@@ -730,8 +728,11 @@ public class XMLEncoder extends Encoder {
else
if
(!
methodName
.
equals
(
"new"
)
&&
!
methodName
.
equals
(
"newInstance"
))
{
attributes
=
attributes
+
" method="
+
quote
(
methodName
);
}
outputXML
(
tag
,
attributes
,
value
,
args
);
}
Vector
statements
=
statementList
(
value
);
private
void
outputXML
(
String
tag
,
String
attributes
,
Object
value
,
Object
...
args
)
{
List
<
Statement
>
statements
=
statementList
(
value
);
// Use XML's short form when there is no body.
if
(
args
.
length
==
0
&&
statements
.
size
()
==
0
)
{
writeln
(
"<"
+
tag
+
attributes
+
"/>"
);
...
...
@@ -745,8 +746,8 @@ public class XMLEncoder extends Encoder {
outputValue
(
args
[
i
],
null
,
true
);
}
for
(
int
i
=
0
;
i
<
statements
.
size
();
i
++
)
{
Statement
s
=
(
Statement
)
statements
.
get
(
i
);
while
(!
statements
.
isEmpty
()
)
{
Statement
s
=
statements
.
remove
(
0
);
outputStatement
(
s
,
value
,
false
);
}
...
...
src/share/classes/javax/swing/JTable.java
浏览文件 @
db17c56c
...
...
@@ -2506,10 +2506,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
Color
old
=
this
.
selectionForeground
;
this
.
selectionForeground
=
selectionForeground
;
firePropertyChange
(
"selectionForeground"
,
old
,
selectionForeground
);
if
(
!
selectionForeground
.
equals
(
old
)
)
{
repaint
();
}
repaint
();
}
/**
...
...
@@ -2547,10 +2544,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
Color
old
=
this
.
selectionBackground
;
this
.
selectionBackground
=
selectionBackground
;
firePropertyChange
(
"selectionBackground"
,
old
,
selectionBackground
);
if
(
!
selectionBackground
.
equals
(
old
)
)
{
repaint
();
}
repaint
();
}
/**
...
...
src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java
浏览文件 @
db17c56c
...
...
@@ -62,6 +62,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI
(
scrollbar
.
getLayout
()
instanceof
UIResource
))
{
scrollbar
.
setLayout
(
this
);
}
configureScrollBarColors
();
updateStyle
(
scrollbar
);
}
...
...
src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
浏览文件 @
db17c56c
...
...
@@ -45,8 +45,7 @@ import javax.swing.JLabel;
import
javax.swing.JTable
;
import
javax.swing.LookAndFeel
;
import
javax.swing.border.Border
;
import
javax.swing.plaf.ComponentUI
;
import
javax.swing.plaf.UIResource
;
import
javax.swing.plaf.*
;
import
javax.swing.plaf.basic.BasicTableUI
;
import
javax.swing.table.DefaultTableCellRenderer
;
import
javax.swing.table.JTableHeader
;
...
...
@@ -158,7 +157,7 @@ public class SynthTableUI extends BasicTableUI
if
(
gridColor
==
null
)
{
gridColor
=
style
.
getColor
(
context
,
ColorType
.
FOREGROUND
);
}
table
.
setGridColor
(
gridColor
);
table
.
setGridColor
(
gridColor
==
null
?
new
ColorUIResource
(
Color
.
GRAY
)
:
gridColor
);
}
useTableColors
=
style
.
getBoolean
(
context
,
...
...
src/share/classes/javax/swing/text/DefaultEditorKit.java
浏览文件 @
db17c56c
...
...
@@ -1461,13 +1461,17 @@ public class DefaultEditorKit extends EditorKit {
// Make sure the new visible location contains
// the location of dot, otherwise Caret will
// cause an additional scroll.
adjustScrollIfNecessary
(
target
,
newVis
,
initialY
,
newIndex
);
if
(
select
)
{
target
.
moveCaretPosition
(
newIndex
);
}
else
{
target
.
setCaretPosition
(
newIndex
);
int
newY
=
getAdjustedY
(
target
,
newVis
,
newIndex
);
if
(
direction
==
-
1
&&
newY
<=
initialY
||
direction
==
1
&&
newY
>=
initialY
)
{
// Change index and correct newVis.y only if won't cause scrolling upward
newVis
.
y
=
newY
;
if
(
select
)
{
target
.
moveCaretPosition
(
newIndex
);
}
else
{
target
.
setCaretPosition
(
newIndex
);
}
}
}
}
catch
(
BadLocationException
ble
)
{
}
...
...
@@ -1513,34 +1517,27 @@ public class DefaultEditorKit extends EditorKit {
}
/**
*
Adjusts the rectangle
that indicates the location to scroll to
*
Returns adjustsed {@code y} position
that indicates the location to scroll to
* after selecting <code>index</code>.
*/
private
void
adjustScrollIfNecessary
(
JTextComponent
text
,
Rectangle
visible
,
int
initialY
,
int
index
)
{
private
int
getAdjustedY
(
JTextComponent
text
,
Rectangle
visible
,
int
index
)
{
int
result
=
visible
.
y
;
try
{
Rectangle
dotBounds
=
text
.
modelToView
(
index
);
if
(
dotBounds
.
y
<
visible
.
y
||
(
dotBounds
.
y
>
(
visible
.
y
+
visible
.
height
))
||
(
dotBounds
.
y
+
dotBounds
.
height
)
>
(
visible
.
y
+
visible
.
height
))
{
int
y
;
if
(
dotBounds
.
y
<
visible
.
y
)
{
y
=
dotBounds
.
y
;
}
else
{
y
=
dotBounds
.
y
+
dotBounds
.
height
-
visible
.
height
;
}
if
((
direction
==
-
1
&&
y
<
initialY
)
||
(
direction
==
1
&&
y
>
initialY
))
{
// Only adjust if won't cause scrolling upward.
visible
.
y
=
y
;
if
(
dotBounds
.
y
<
visible
.
y
)
{
result
=
dotBounds
.
y
;
}
else
{
if
((
dotBounds
.
y
>
visible
.
y
+
visible
.
height
)
||
(
dotBounds
.
y
+
dotBounds
.
height
>
visible
.
y
+
visible
.
height
))
{
result
=
dotBounds
.
y
+
dotBounds
.
height
-
visible
.
height
;
}
}
}
catch
(
BadLocationException
ble
)
{}
}
catch
(
BadLocationException
ble
)
{
}
return
result
;
}
/**
...
...
test/java/beans/XMLEncoder/Test5023550.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 5023550
* @summary Tests complex references to owner
* @author Sergey Malenkov
*/
import
java.beans.DefaultPersistenceDelegate
;
import
java.beans.Encoder
;
import
java.beans.Expression
;
import
java.beans.XMLDecoder
;
import
java.beans.XMLEncoder
;
public
class
Test5023550
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test5023550
().
test
(
true
);
}
private
final
Owner
owner
=
new
Owner
();
@Override
protected
void
initialize
(
XMLEncoder
encoder
)
{
encoder
.
setOwner
(
this
.
owner
);
encoder
.
setPersistenceDelegate
(
A
.
class
,
new
ADelegate
());
encoder
.
setPersistenceDelegate
(
B
.
class
,
new
BDelegate
());
encoder
.
setPersistenceDelegate
(
C
.
class
,
new
CDelegate
());
}
@Override
protected
void
initialize
(
XMLDecoder
decoder
)
{
decoder
.
setOwner
(
this
.
owner
);
}
protected
Object
getObject
()
{
return
this
.
owner
.
newA
(
this
.
owner
.
newB
().
newC
());
}
public
static
class
Owner
{
public
A
newA
(
C
c
)
{
return
new
A
(
c
);
}
public
B
newB
()
{
return
new
B
();
}
}
public
static
class
A
{
private
final
C
c
;
private
A
(
C
c
)
{
this
.
c
=
c
;
}
public
C
getC
()
{
return
this
.
c
;
}
}
public
static
class
B
{
public
C
newC
()
{
return
new
C
(
this
);
}
}
public
static
class
C
{
private
final
B
b
;
private
C
(
B
b
)
{
this
.
b
=
b
;
}
public
B
getB
()
{
return
this
.
b
;
}
}
public
static
class
ADelegate
extends
DefaultPersistenceDelegate
{
protected
Expression
instantiate
(
Object
old
,
Encoder
out
)
{
XMLEncoder
encoder
=
(
XMLEncoder
)
out
;
A
a
=
(
A
)
old
;
return
new
Expression
(
old
,
encoder
.
getOwner
(),
"newA"
,
new
Object
[]
{
a
.
getC
()
});
}
}
public
static
class
BDelegate
extends
DefaultPersistenceDelegate
{
protected
Expression
instantiate
(
Object
old
,
Encoder
out
)
{
XMLEncoder
encoder
=
(
XMLEncoder
)
out
;
return
new
Expression
(
old
,
encoder
.
getOwner
(),
"newB"
,
new
Object
[
0
]);
}
}
public
static
class
CDelegate
extends
DefaultPersistenceDelegate
{
protected
Expression
instantiate
(
Object
old
,
Encoder
out
)
{
C
c
=
(
C
)
old
;
return
new
Expression
(
c
,
c
.
getB
(),
"newC"
,
new
Object
[
0
]);
}
}
}
test/java/beans/XMLEncoder/Test5023557.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 5023557
* @summary Tests complex references
* @author Sergey Malenkov
*/
import
java.beans.DefaultPersistenceDelegate
;
import
java.beans.Encoder
;
import
java.beans.Expression
;
import
java.beans.XMLEncoder
;
public
class
Test5023557
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test5023557
().
test
(
true
);
}
@Override
protected
void
initialize
(
XMLEncoder
encoder
)
{
encoder
.
setPersistenceDelegate
(
B
.
class
,
new
BDelegate
());
encoder
.
setPersistenceDelegate
(
C
.
class
,
new
CDelegate
());
}
protected
Object
getObject
()
{
A
a
=
new
A
();
return
a
.
newC
(
a
.
newB
());
}
public
static
class
A
{
public
B
newB
()
{
return
new
B
(
this
);
}
public
C
newC
(
B
b
)
{
return
new
C
(
b
);
}
}
public
static
class
B
{
private
final
A
a
;
private
B
(
A
a
)
{
this
.
a
=
a
;
}
public
A
getA
()
{
return
this
.
a
;
}
}
public
static
class
C
{
private
final
B
b
;
private
C
(
B
b
)
{
this
.
b
=
b
;
}
public
B
getB
()
{
return
this
.
b
;
}
}
public
static
class
BDelegate
extends
DefaultPersistenceDelegate
{
protected
Expression
instantiate
(
Object
old
,
Encoder
out
)
{
B
b
=
(
B
)
old
;
return
new
Expression
(
b
,
b
.
getA
(),
"newB"
,
new
Object
[
0
]);
}
}
public
static
class
CDelegate
extends
DefaultPersistenceDelegate
{
protected
Expression
instantiate
(
Object
old
,
Encoder
out
)
{
C
c
=
(
C
)
old
;
return
new
Expression
(
c
,
c
.
getB
().
getA
(),
"newC"
,
new
Object
[]
{
c
.
getB
()
});
}
}
}
test/java/beans/XMLEncoder/Test6921644.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 6921644
* @summary Tests references to cached integer
* @author Sergey Malenkov
*/
import
java.beans.ConstructorProperties
;
import
java.util.ArrayList
;
import
java.util.List
;
public
final
class
Test6921644
extends
AbstractTest
{
public
static
void
main
(
String
[]
args
)
{
new
Test6921644
().
test
(
true
);
}
protected
Object
getObject
()
{
Owner
<
Author
>
o
=
new
Owner
<
Author
>(
100
);
// it works if ID >= 128
Category
c
=
new
Category
(
o
);
Document
d1
=
new
Document
(
o
);
Document
d2
=
new
Document
(
o
);
Document
d3
=
new
Document
(
o
);
Author
a1
=
new
Author
(
o
);
Author
a2
=
new
Author
(
o
);
Author
a3
=
new
Author
(
o
);
o
.
getList
().
add
(
a1
);
o
.
getList
().
add
(
a2
);
o
.
getList
().
add
(
a3
);
a3
.
setRef
(
o
.
getId
());
d2
.
setCategory
(
c
);
d3
.
setCategory
(
c
);
a1
.
addDocument
(
d1
);
a1
.
addDocument
(
d2
);
a3
.
addDocument
(
d3
);
c
.
addDocument
(
d2
);
c
.
addDocument
(
d3
);
return
o
;
}
public
static
class
Owner
<
T
>
{
private
int
id
;
private
List
<
T
>
list
=
new
ArrayList
<
T
>();
@ConstructorProperties
(
"id"
)
public
Owner
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getId
()
{
return
this
.
id
;
}
public
List
<
T
>
getList
()
{
return
this
.
list
;
}
public
void
setList
(
List
<
T
>
list
)
{
this
.
list
=
list
;
}
}
public
static
class
Author
{
private
int
id
;
private
int
ref
;
private
Owner
owner
;
private
List
<
Document
>
list
=
new
ArrayList
<
Document
>();
@ConstructorProperties
(
"owner"
)
public
Author
(
Owner
<
Author
>
owner
)
{
this
.
owner
=
owner
;
this
.
id
=
owner
.
getId
();
}
public
Owner
getOwner
()
{
return
this
.
owner
;
}
public
Integer
getId
()
{
return
this
.
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getRef
()
{
return
this
.
ref
;
}
public
void
setRef
(
Integer
ref
)
{
this
.
ref
=
ref
;
}
public
List
<
Document
>
getList
()
{
return
this
.
list
;
}
public
void
setList
(
List
<
Document
>
list
)
{
this
.
list
=
list
;
}
public
void
addDocument
(
Document
document
)
{
this
.
list
.
add
(
document
);
document
.
setAuthor
(
this
);
}
}
public
static
class
Category
{
private
Owner
owner
;
private
List
<
Document
>
list
=
new
ArrayList
<
Document
>();
@ConstructorProperties
(
"owner"
)
public
Category
(
Owner
owner
)
{
this
.
owner
=
owner
;
}
public
Owner
getOwner
()
{
return
this
.
owner
;
}
public
List
<
Document
>
getList
()
{
return
this
.
list
;
}
public
void
setList
(
List
<
Document
>
list
)
{
this
.
list
=
list
;
}
public
void
addDocument
(
Document
document
)
{
this
.
list
.
add
(
document
);
document
.
setCategory
(
this
);
}
}
public
static
class
Document
{
private
Owner
owner
;
private
Author
author
;
private
Category
category
;
@ConstructorProperties
(
"owner"
)
public
Document
(
Owner
owner
)
{
this
.
owner
=
owner
;
}
public
Owner
getOwner
()
{
return
this
.
owner
;
}
public
Author
getAuthor
()
{
return
this
.
author
;
}
public
void
setAuthor
(
Author
author
)
{
this
.
author
=
author
;
}
public
Category
getCategory
()
{
return
this
.
category
;
}
public
void
setCategory
(
Category
category
)
{
this
.
category
=
category
;
}
}
}
test/javax/swing/JEditorPane/6917744/bug6917744.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 6917744
* @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
* @author Pavel Porvatov
* @run main bug6917744
*/
import
java.awt.*
;
import
java.awt.event.KeyEvent
;
import
java.io.IOException
;
import
javax.swing.*
;
import
sun.awt.SunToolkit
;
public
class
bug6917744
{
private
static
JFrame
frame
;
private
static
JEditorPane
editorPane
;
private
static
JScrollPane
scrollPane
;
private
static
Robot
robot
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
robot
=
new
Robot
();
robot
.
setAutoDelay
(
100
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
=
new
JFrame
();
editorPane
=
new
JEditorPane
();
try
{
editorPane
.
setPage
(
bug6917744
.
class
.
getResource
(
"/test.html"
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"HTML resource not found"
,
e
);
}
scrollPane
=
new
JScrollPane
(
editorPane
);
frame
.
getContentPane
().
add
(
scrollPane
);
frame
.
setSize
(
400
,
300
);
frame
.
setVisible
(
true
);
}
});
toolkit
.
realSync
();
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
robot
.
keyPress
(
KeyEvent
.
VK_PAGE_DOWN
);
}
toolkit
.
realSync
();
// Check that we at the end of document
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
BoundedRangeModel
model
=
scrollPane
.
getVerticalScrollBar
().
getModel
();
if
(
model
.
getValue
()
+
model
.
getExtent
()
!=
model
.
getMaximum
())
{
throw
new
RuntimeException
(
"Invalid HTML position"
);
}
}
});
toolkit
.
realSync
();
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
robot
.
keyPress
(
KeyEvent
.
VK_PAGE_UP
);
}
toolkit
.
realSync
();
// Check that we at the begin of document
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
BoundedRangeModel
model
=
scrollPane
.
getVerticalScrollBar
().
getModel
();
if
(
model
.
getValue
()
!=
model
.
getMinimum
())
{
throw
new
RuntimeException
(
"Invalid HTML position"
);
}
frame
.
dispose
();
}
});
}
}
test/javax/swing/JEditorPane/6917744/test.html
0 → 100644
浏览文件 @
db17c56c
<html>
<body
bgcolor=
"#ffffff"
>
<table
border=
"0"
>
<tr>
<td>
</td>
<td
valign=
"top"
>
<font
size=
"+1"
face=
"Arial, Helvetica, sans-serif"
>
<b>
TEST FOR JScrollPane BUG
</b>
<br>
</font>
<font
face=
"Arial, Helvetica, sans-serif"
size=
"-1"
>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<font
size=
"+1"
face=
"Arial, Helvetica, sans-serif"
>
<b>
END OF TEST FOR JScrollPane BUG
</b>
<br>
</font>
</font>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
test/javax/swing/JScrollBar/6924059/bug6924059.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 6924059
* @summary SynthScrollBarUI.configureScrollBarColors() should have spec different from the overridden method
* @author Pavel Porvatov
* @run main bug6924059
*/
import
javax.swing.*
;
import
javax.swing.plaf.synth.SynthLookAndFeel
;
import
javax.swing.plaf.synth.SynthScrollBarUI
;
public
class
bug6924059
{
private
static
boolean
isMethodCalled
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
UIManager
.
setLookAndFeel
(
new
SynthLookAndFeel
());
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
new
JScrollBar
().
setUI
(
new
SynthScrollBarUI
()
{
protected
void
configureScrollBarColors
()
{
super
.
configureScrollBarColors
();
isMethodCalled
=
true
;
}
});
if
(!
isMethodCalled
)
{
throw
new
RuntimeException
(
"The configureScrollBarColors was not called"
);
}
}
});
}
}
test/javax/swing/JTable/6913768/bug6913768.java
0 → 100644
浏览文件 @
db17c56c
/*
* Copyright 2010 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 6913768
* @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE
* @author Pavel Porvatov
* @run main bug6913768
*/
import
javax.swing.*
;
import
javax.swing.plaf.synth.SynthLookAndFeel
;
public
class
bug6913768
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
UIManager
.
setLookAndFeel
(
new
SynthLookAndFeel
());
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
JFrame
frame
=
new
JFrame
();
JTable
table
=
new
JTable
(
new
Object
[][]{{
"1"
,
"2"
},
{
"3"
,
"4"
}},
new
Object
[]{
"col1"
,
"col2"
});
frame
.
getContentPane
().
add
(
new
JScrollPane
(
table
));
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setSize
(
300
,
200
);
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
}
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录