2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
42 import java
.awt
.event
.*;
46 import javax
.accessibility
.*;
47 import javax
.swing
.event
.*;
51 * @author Andrew Selkirk
56 implements Accessible
, MenuElement
58 static final long serialVersionUID
= 4227225638931828014L;
60 //-------------------------------------------------------------
61 // Classes ----------------------------------------------------
62 //-------------------------------------------------------------
67 protected class AccessibleJMenu
extends AccessibleJMenuItem
68 implements AccessibleSelection
{
70 //-------------------------------------------------------------
71 // Variables --------------------------------------------------
72 //-------------------------------------------------------------
75 //-------------------------------------------------------------
76 // Initialization ---------------------------------------------
77 //-------------------------------------------------------------
80 * Constructor AccessibleJMenu
81 * @param component TODO
83 protected AccessibleJMenu(JMenu component
) {
86 } // AccessibleJMenu()
89 //-------------------------------------------------------------
90 // Methods ----------------------------------------------------
91 //-------------------------------------------------------------
94 * getAccessibleChildrenCount
97 public int getAccessibleChildrenCount() {
99 } // getAccessibleChildrenCount()
104 * @returns Accessible
106 public Accessible
getAccessibleChild(int value0
) {
108 } // getAccessibleChild()
111 * getAccessibleSelection
112 * @returns AccessibleSelection
114 public AccessibleSelection
getAccessibleSelection() {
116 } // getAccessibleSelection()
119 * getAccessibleSelection
121 * @returns Accessible
123 public Accessible
getAccessibleSelection(int value0
) {
125 } // getAccessibleSelection()
128 * isAccessibleChildSelected
132 public boolean isAccessibleChildSelected(int value0
) {
133 return false; // TODO
134 } // isAccessibleChildSelected()
138 * @returns AccessibleRole
140 public AccessibleRole
getAccessibleRole() {
141 return AccessibleRole
.MENU
;
142 } // getAccessibleRole()
145 * getAccessibleSelectionCount
148 public int getAccessibleSelectionCount() {
150 } // getAccessibleSelectionCount()
153 * addAccessibleSelection
156 public void addAccessibleSelection(int value0
) {
158 } // addAccessibleSelection()
161 * removeAccessibleSelection
164 public void removeAccessibleSelection(int value0
) {
166 } // removeAccessibleSelection()
169 * clearAccessibleSelection
171 public void clearAccessibleSelection() {
173 } // clearAccessibleSelection()
176 * selectAllAccessibleSelection
178 public void selectAllAccessibleSelection() {
180 } // selectAllAccessibleSelection()
188 protected class WinListener
extends WindowAdapter
implements Serializable
{
190 //-------------------------------------------------------------
191 // Variables --------------------------------------------------
192 //-------------------------------------------------------------
197 JPopupMenu popupMenu
;
200 //-------------------------------------------------------------
201 // Initialization ---------------------------------------------
202 //-------------------------------------------------------------
205 * Constructor WinListener
209 public WinListener(JMenu value0
, JPopupMenu value1
) {
214 //-------------------------------------------------------------
215 // Methods ----------------------------------------------------
216 //-------------------------------------------------------------
222 public void windowClosing(WindowEvent value0
) {
230 //-------------------------------------------------------------
231 // Variables --------------------------------------------------
232 //-------------------------------------------------------------
237 private static final String uiClassID
= "MenuUI";
242 private JPopupMenu popupMenu
;
247 private ChangeListener menuChangeListener
;
252 private MenuEvent menuEvent
;
257 private static Hashtable listenerRegistry
= null; // TODO
267 private static final boolean TRACE
= false; // TODO
272 private static final boolean VERBOSE
= false; // TODO
277 private static final boolean DEBUG
= false; // TODO
282 protected JMenu
.WinListener popupListener
;
285 //-------------------------------------------------------------
286 // Initialization ---------------------------------------------
287 //-------------------------------------------------------------
300 public JMenu(String text
) {
308 public JMenu(Action action
) {
315 * @param tearoff TODO
317 public JMenu(String text
, boolean tearoff
) {
322 //-------------------------------------------------------------
323 // Methods ----------------------------------------------------
324 //-------------------------------------------------------------
329 * @exception IOException TODO
331 private void writeObject(ObjectOutputStream stream
) throws IOException
{
340 public JMenuItem
add(JMenuItem item
) {
346 * @param component TODO
349 public Component
add(Component component
) {
355 * @param component TODO
359 public Component
add(Component component
, int index
) {
368 public JMenuItem
add(String text
) {
377 public JMenuItem
add(Action action
) {
385 public void remove(JMenuItem item
) {
393 public void remove(int index
) {
399 * @param component TODO
401 public void remove(Component component
) {
408 public void removeAll() {
417 public void insert(String text
, int index
) {
427 public JMenuItem
insert(JMenuItem item
, int index
) {
437 public JMenuItem
insert(Action action
, int index
) {
444 public void updateUI() {
445 //setUI((MenuUI) UIManager.get(this));
453 public String
getUIClassID() {
461 public void setModel(ButtonModel model
) {
469 public boolean isSelected() {
470 return false; // TODO
475 * @param selected TODO
477 public void setSelected(boolean selected
) {
485 public boolean isPopupMenuVisible() {
486 return false; // TODO
487 } // isPopupMenuVisible()
490 * setPopupMenuVisible
493 public void setPopupMenuVisible(boolean popup
) {
495 } // setPopupMenuVisible()
501 protected Point
getPopupMenuOrigin() {
503 } // getPopupMenuOrigin()
509 public int getDelay() {
517 public void setDelay(int delay
) {
526 public void setMenuLocation(int x
, int y
) {
528 } // setMenuLocation()
531 * createActionComponent
535 protected JMenuItem
createActionComponent(Action action
) {
537 } // createActionComponent()
540 * createActionChangeListener
542 * @returns PropertyChangeListener
544 protected PropertyChangeListener
createActionChangeListener(JMenuItem item
) {
546 } // createActionChangeListener()
551 public void addSeparator() {
559 public void insertSeparator(int index
) {
561 } // insertSeparator()
568 public JMenuItem
getItem(int index
) {
576 public int getItemCount() {
584 public boolean isTearOff() {
585 return false; // TODO
589 * getMenuComponentCount
592 public int getMenuComponentCount() {
594 } // getMenuComponentCount()
601 public Component
getMenuComponent(int index
) {
603 } // getMenuComponent()
607 * @returns Component[]
609 public Component
[] getMenuComponents() {
611 } // getMenuComponents()
617 public boolean isTopLevelMenu() {
618 return false; // TODO
619 } // isTopLevelMenu()
623 * @param component TODO
626 public boolean isMenuComponent(Component component
) {
627 return false; // TODO
628 } // isMenuComponent()
632 * @returns JPopupMenu
634 public JPopupMenu
getPopupMenu() {
640 * @param listener TODO
642 public void addMenuListener(MenuListener listener
) {
644 } // addMenuListener()
648 * @param listener TODO
650 public void removeMenuListener(MenuListener listener
) {
652 } // removeMenuListener()
657 protected void fireMenuSelected() {
659 } // fireMenuSelected()
664 protected void fireMenuDeselected() {
666 } // fireMenuDeselected()
671 protected void fireMenuCanceled() {
673 } // fireMenuCanceled()
676 * createMenuChangeListener
677 * @returns ChangeListener
679 private ChangeListener
createMenuChangeListener() {
681 } // createMenuChangeListener()
686 * @returns JMenu.WinListener
688 protected JMenu
.WinListener
createWinListener(JPopupMenu popup
) {
690 } // createWinListener()
693 * menuSelectionChanged
696 public void menuSelectionChanged(boolean changed
) {
698 } // menuSelectionChanged()
702 * @returns MenuElement[]
704 public MenuElement
[] getSubElements() {
706 } // getSubElements()
712 public Component
getComponent() {
718 * @param keystroke TODO
720 public void setAccelerator(KeyStroke keystroke
) {
722 } // setAccelerator()
728 protected void processKeyEvent(KeyEvent event
) {
730 } // processKeyEvent()
736 public void doClick(int time
) {
744 protected String
paramString() {
749 * getAccessibleContext
750 * @returns AccessibleContext
752 public AccessibleContext
getAccessibleContext() {
753 if (accessibleContext
== null) {
754 accessibleContext
= new AccessibleJMenu(this);
756 return accessibleContext
;
757 } // getAccessibleContext()