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
d379aac4
Kaydet (Commit)
d379aac4
authored
Nis 11, 2003
tarafından
Vladimir Glazounov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS vcl07 (1.2.2); FILE ADDED
2003/04/08 14:28:58 obr 1.2.2.1: re-added accessibility workbench
üst
605d33e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
179 additions
and
0 deletions
+179
-0
SelectionDialog.java
toolkit/test/accessibility/SelectionDialog.java
+179
-0
No files found.
toolkit/test/accessibility/SelectionDialog.java
0 → 100644
Dosyayı görüntüle @
d379aac4
import
com.sun.star.uno.UnoRuntime
;
import
drafts.com.sun.star.accessibility.XAccessible
;
import
drafts.com.sun.star.accessibility.XAccessibleContext
;
import
drafts.com.sun.star.accessibility.XAccessibleSelection
;
import
com.sun.star.lang.IndexOutOfBoundsException
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.util.Vector
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionEvent
;
/**
* Display a dialog with a list-box of children and select/deselect buttons
*/
class
SelectionDialog
extends
JDialog
implements
ActionListener
{
public
SelectionDialog
(
AccTreeNode
aNode
)
{
super
(
AccessibilityWorkBench
.
Instance
());
maNode
=
aNode
;
Layout
();
}
/** build dialog */
protected
void
Layout
()
{
setTitle
(
"Select"
);
// vertical stacking of the elements
Container
aContent
=
getContentPane
();
// label with explanation
aContent
.
add
(
new
JLabel
(
"Select/Deselect child elements"
),
BorderLayout
.
NORTH
);
// the JListBox
maChildrenSelector
=
new
JList
(
GetChildrenList
());
maChildrenSelector
.
setPreferredSize
(
new
Dimension
(
500
,
300
));
aContent
.
add
(
maChildrenSelector
,
BorderLayout
.
CENTER
);
maChildrenSelector
.
setSelectionMode
(
ListSelectionModel
.
SINGLE_SELECTION
);
JPanel
aButtons
=
new
JPanel
();
aButtons
.
setLayout
(
new
FlowLayout
()
);
JButton
aButton
;
aButton
=
new
JButton
(
"Select"
);
aButton
.
setActionCommand
(
"Select"
);
aButton
.
addActionListener
(
this
);
aButtons
.
add
(
aButton
);
aButton
=
new
JButton
(
"Deselect"
);
aButton
.
setActionCommand
(
"Deselect"
);
aButton
.
addActionListener
(
this
);
aButtons
.
add
(
aButton
);
aButton
=
new
JButton
(
"Select all"
);
aButton
.
setActionCommand
(
"Select all"
);
aButton
.
addActionListener
(
this
);
aButtons
.
add
(
aButton
);
aButton
=
new
JButton
(
"Clear Selection"
);
aButton
.
setActionCommand
(
"Clear Selection"
);
aButton
.
addActionListener
(
this
);
aButtons
.
add
(
aButton
);
aButton
=
new
JButton
(
"Close"
);
aButton
.
setActionCommand
(
"Close"
);
aButton
.
addActionListener
(
this
);
aButtons
.
add
(
aButton
);
// add Panel with buttons
aContent
.
add
(
aButtons
,
BorderLayout
.
SOUTH
);
setSize
(
getPreferredSize
()
);
}
/** Get a list of all children
*/
private
Vector
GetChildrenList
()
{
mxSelection
=
maNode
.
getSelection
();
XAccessibleContext
xContext
=
maNode
.
getContext
();
int
nCount
=
xContext
.
getAccessibleChildCount
();
Vector
aChildVector
=
new
Vector
();
for
(
int
i
=
0
;
i
<
nCount
;
i
++)
{
try
{
XAccessible
xChild
=
xContext
.
getAccessibleChild
(
i
);
XAccessibleContext
xChildContext
=
xChild
.
getAccessibleContext
();
aChildVector
.
add
(
i
+
" "
+
xChildContext
.
getAccessibleName
());
}
catch
(
IndexOutOfBoundsException
e
)
{
aChildVector
.
add
(
"ERROR: IndexOutOfBoundsException"
);
}
}
return
aChildVector
;
}
void
close
()
{
hide
();
dispose
();
}
void
select
()
{
try
{
mxSelection
.
selectAccessibleChild
(
maChildrenSelector
.
getSelectedIndex
());
}
catch
(
IndexOutOfBoundsException
e
)
{
JOptionPane
.
showMessageDialog
(
AccessibilityWorkBench
.
Instance
(),
"Can't select: IndexOutofBounds"
,
"Error in selectAccessibleChild"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
void
deselect
()
{
try
{
mxSelection
.
deselectSelectedAccessibleChild
(
maChildrenSelector
.
getSelectedIndex
());
}
catch
(
IndexOutOfBoundsException
e
)
{
JOptionPane
.
showMessageDialog
(
AccessibilityWorkBench
.
Instance
(),
"Can't deselect: IndexOutofBounds"
,
"Error in deselectAccessibleChild"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
void
selectAll
()
{
mxSelection
.
selectAllAccessible
();
}
void
clearSelection
()
{
mxSelection
.
clearAccessibleSelection
();
}
public
void
actionPerformed
(
ActionEvent
e
)
{
String
sCommand
=
e
.
getActionCommand
();
if
(
"Close"
.
equals
(
sCommand
)
)
close
();
else
if
(
"Select"
.
equals
(
sCommand
)
)
select
();
else
if
(
"Deselect"
.
equals
(
sCommand
)
)
deselect
();
else
if
(
"Clear Selection"
.
equals
(
sCommand
)
)
clearSelection
();
else
if
(
"Select all"
.
equals
(
sCommand
)
)
selectAll
();
}
private
JList
maChildrenSelector
;
private
XAccessibleSelection
mxSelection
;
private
AccTreeNode
maNode
;
}
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