Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
8bb7115d
Kaydet (Commit)
8bb7115d
authored
May 19, 2003
tarafından
Andre Fischer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implemented state set view.
üst
36756282
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
14 deletions
+152
-14
ObjectViewContainer.java
toolkit/test/accessibility/ov/ObjectViewContainer.java
+1
-1
StateSetView.java
toolkit/test/accessibility/ov/StateSetView.java
+151
-13
No files found.
toolkit/test/accessibility/ov/ObjectViewContainer.java
Dosyayı görüntüle @
8bb7115d
...
...
@@ -43,7 +43,7 @@ public class ObjectViewContainer
// Add new views.
Add
(
ContextView
.
Create
(
xContext
));
//
Add (StateSetView.Create(xContext));
Add
(
StateSetView
.
Create
(
xContext
));
Add
(
FocusView
.
Create
(
xContext
));
Add
(
SelectionView
.
Create
(
xContext
));
Add
(
TextView
.
Create
(
xContext
));
...
...
toolkit/test/accessibility/ov/StateSetView.java
Dosyayı görüntüle @
8bb7115d
package
ov
;
import
java.awt.Color
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Insets
;
import
java.awt.Rectangle
;
import
java.awt.RenderingHints
;
import
java.awt.Shape
;
import
java.awt.event.MouseListener
;
import
java.awt.event.MouseEvent
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.AffineTransform
;
import
java.awt.BorderLayout
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.border.Border
;
import
com.sun.star.accessibility.XAccessibleContext
;
import
com.sun.star.accessibility.AccessibleEventObject
;
import
com.sun.star.accessibility.AccessibleEventId
;
import
com.sun.star.accessibility.AccessibleStateType
;
import
com.sun.star.accessibility.XAccessibleContext
;
import
com.sun.star.accessibility.XAccessibleStateSet
;
import
tools.NameProvider
;
public
class
StateSetView
extends
ListeningObjectView
implements
MouseListener
{
/** Create a FocusView when the given object supports the
XAccessibleComponent interface.
...
...
@@ -31,30 +46,132 @@ public class StateSetView
public
StateSetView
()
{
mxCanvas
=
new
JPanel
();
add
(
mxCanvas
,
BorderLayout
.
CENTER
);
maStates
=
null
;
mnViewMode
=
SHOW_ALL_STATES
;
setPreferredSize
(
new
Dimension
(
300
,
90
));
setMinimumSize
(
new
Dimension
(
200
,
80
));
addMouseListener
(
this
);
}
public
void
paintChildren
(
Graphics
g
)
{
synchronized
(
g
)
{
System
.
out
.
println
(
"Paint"
);
super
.
paintChildren
(
g
);
Dimension
aSize
=
mxCanvas
.
getSize
();
// Calculcate the are inside the border.
Insets
aInsets
=
getInsets
();
Dimension
aSize
=
getSize
();
Rectangle
aWidgetArea
=
new
Rectangle
(
aInsets
.
left
,
aInsets
.
top
,
aSize
.
width
-
aInsets
.
left
-
aInsets
.
right
,
aSize
.
height
-
aInsets
.
top
-
aInsets
.
bottom
);
Graphics2D
g2
=
(
Graphics2D
)
g
;
Shape
aWidgetArea
=
g
.
getClip
();
switch
(
mnViewMode
)
{
case
SHOW_ALL_STATES
:
PaintAllStates
((
Graphics2D
)
g
,
aWidgetArea
);
break
;
case
SHOW_SET_STATES
:
PaintSetStates
((
Graphics2D
)
g
,
aWidgetArea
);
break
;
}
}
}
g2
.
setColor
(
new
Color
(
250
,
240
,
230
));
g2
.
fill
(
aWidgetArea
);
private
void
SetViewMode
(
int
nViewMode
)
{
mnViewMode
=
nViewMode
;
switch
(
mnViewMode
)
{
case
SHOW_SET_STATES
:
maStates
=
new
JLabel
();
add
(
maStates
,
BorderLayout
.
CENTER
);
Update
();
break
;
case
SHOW_ALL_STATES
:
if
(
maStates
!=
null
)
{
remove
(
maStates
);
maStates
=
null
;
}
repaint
();
break
;
}
}
super
.
paintChildren
(
g
);
private
void
PaintSetStates
(
Graphics2D
g
,
Rectangle
aWidgetArea
)
{
}
private
void
PaintAllStates
(
Graphics2D
g
,
Rectangle
aWidgetArea
)
{
Color
aTextColor
=
g
.
getColor
();
g
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
XAccessibleStateSet
xStateSet
=
mxContext
.
getAccessibleStateSet
();
if
(
xStateSet
!=
null
)
{
short
aStates
[]
=
xStateSet
.
getStates
();
final
int
nMaxStateIndex
=
AccessibleStateType
.
MANAGES_DESCENDANTS
;
int
nStateWidth
=
(
aWidgetArea
.
width
-
12
)
/
(
nMaxStateIndex
+
1
);
AffineTransform
aTransform
=
g
.
getTransform
();
g
.
setColor
(
aTextColor
);
int
y
=
aWidgetArea
.
y
+
aWidgetArea
.
height
-
12
;
double
nTextRotation
=
-
0.9
;
//-java.lang.Math.PI/2;
double
nScale
=
0.6
;
// Create a shape for the boxes.
int
nBoxWidth
=
nStateWidth
-
2
;
if
(
nBoxWidth
>
8
)
nBoxWidth
=
8
;
Rectangle
aCheckBox
=
new
Rectangle
(-
nBoxWidth
/
2
,
0
,
nBoxWidth
,
nBoxWidth
);
for
(
short
i
=
0
;
i
<=
nMaxStateIndex
;
i
++)
{
int
x
=
nStateWidth
+
i
*
nStateWidth
;
String
sStateName
=
NameProvider
.
getStateName
(
i
);
boolean
bStateSet
=
xStateSet
.
contains
(
i
);
g
.
setTransform
(
aTransform
);
g
.
translate
(
x
,
y
);
if
(
bStateSet
)
{
g
.
setColor
(
Color
.
GREEN
);
g
.
fill
(
aCheckBox
);
g
.
setColor
(
aTextColor
);
}
g
.
draw
(
aCheckBox
);
g
.
rotate
(
nTextRotation
);
g
.
scale
(
nScale
,
nScale
);
g
.
translate
(
2
,-
2
);
g
.
drawString
(
sStateName
,
0
,
0
);
}
}
}
synchronized
public
void
Update
()
{
if
(
mnViewMode
==
SHOW_SET_STATES
)
{
XAccessibleStateSet
xStateSet
=
mxContext
.
getAccessibleStateSet
();
if
(
xStateSet
!=
null
)
{
String
sStates
=
new
String
();
short
aStates
[]
=
xStateSet
.
getStates
();
for
(
int
i
=
0
;
i
<
aStates
.
length
;
i
++)
{
if
(
i
>
0
)
sStates
=
sStates
+
", "
;
sStates
=
sStates
+
NameProvider
.
getStateName
(
aStates
[
i
]);
}
maStates
.
setText
(
sStates
);
}
}
}
public
String
GetTitle
()
...
...
@@ -64,8 +181,29 @@ public class StateSetView
public
void
notifyEvent
(
AccessibleEventObject
aEvent
)
{
System
.
out
.
println
(
aEvent
);
if
(
aEvent
.
EventId
==
AccessibleEventId
.
STATE_CHANGED
)
Update
();
}
public
void
mouseClicked
(
MouseEvent
e
)
{
switch
(
mnViewMode
)
{
case
SHOW_SET_STATES
:
SetViewMode
(
SHOW_ALL_STATES
);
break
;
case
SHOW_ALL_STATES
:
SetViewMode
(
SHOW_SET_STATES
);
break
;
}
}
public
void
mouseEntered
(
MouseEvent
e
)
{}
public
void
mouseExited
(
MouseEvent
e
)
{}
public
void
mousePressed
(
MouseEvent
e
)
{}
public
void
mouseReleased
(
MouseEvent
e
)
{}
private
JPanel
mxCanvas
;
private
JLabel
maStates
;
private
int
mnViewMode
;
private
final
int
SHOW_SET_STATES
=
0
;
private
final
int
SHOW_ALL_STATES
=
1
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment