summaryrefslogtreecommitdiff
path: root/toolkit/test/accessibility/AccessibilityTree.java
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/test/accessibility/AccessibilityTree.java')
-rw-r--r--toolkit/test/accessibility/AccessibilityTree.java86
1 files changed, 43 insertions, 43 deletions
diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java
index 6f9484762e00..72944e30e1ab 100644
--- a/toolkit/test/accessibility/AccessibilityTree.java
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -243,53 +243,53 @@ public class AccessibilityTree
public boolean popupTrigger( MouseEvent e )
{
boolean bIsPopup = e.isPopupTrigger();
- if( bIsPopup )
+ if( !bIsPopup )
+ return false;
+
+ int selRow = maTree.getComponent().getRowForLocation(e.getX(), e.getY());
+ if (selRow == -1)
+ return bIsPopup;
+
+ TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY());
+
+ // check for actions
+ Object aObject = aPath.getLastPathComponent();
+ JPopupMenu aMenu = new JPopupMenu();
+ if( aObject instanceof AccTreeNode )
+ {
+ AccTreeNode aNode = (AccTreeNode)aObject;
+
+ ArrayList<String> aActions = new ArrayList<String>();
+ aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
+ aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
+
+ aNode.getActions(aActions);
+ for( int i = 0; i < aActions.size(); i++ )
+ {
+ aMenu.add( new NodeAction(
+ aActions.get(i),
+ aNode, i ) );
+ }
+ }
+ else if (aObject instanceof AccessibleTreeNode)
{
- int selRow = maTree.getComponent().getRowForLocation(e.getX(), e.getY());
- if (selRow != -1)
+ AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
+ String[] aActionNames = aNode.getActions();
+ int nCount=aActionNames.length;
+ if (nCount > 0)
{
- TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY());
-
- // check for actions
- Object aObject = aPath.getLastPathComponent();
- JPopupMenu aMenu = new JPopupMenu();
- if( aObject instanceof AccTreeNode )
- {
- AccTreeNode aNode = (AccTreeNode)aObject;
-
- ArrayList<String> aActions = new ArrayList<String>();
- aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
- aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
-
- aNode.getActions(aActions);
- for( int i = 0; i < aActions.size(); i++ )
- {
- aMenu.add( new NodeAction(
- aActions.get(i),
- aNode, i ) );
- }
- }
- else if (aObject instanceof AccessibleTreeNode)
- {
- AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
- String[] aActionNames = aNode.getActions();
- int nCount=aActionNames.length;
- if (nCount > 0)
- {
- for (int i=0; i<nCount; i++)
- aMenu.add( new NodeAction(
- aActionNames[i],
- aNode,
- i));
- }
- else
- aMenu = null;
- }
- if (aMenu != null)
- aMenu.show (maTree.getComponent(),
- e.getX(), e.getY());
+ for (int i=0; i<nCount; i++)
+ aMenu.add( new NodeAction(
+ aActionNames[i],
+ aNode,
+ i));
}
+ else
+ aMenu = null;
}
+ if (aMenu != null)
+ aMenu.show (maTree.getComponent(),
+ e.getX(), e.getY());
return bIsPopup;
}