summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2003-03-13 16:14:28 +0000
committerAndre Fischer <af@openoffice.org>2003-03-13 16:14:28 +0000
commit556fa073dd173e663474fb02c93bbd50abcc25ae (patch)
treee2fdc9457fc7e4633fb23be7d5598a3f0f3161e9
parent0a20d897ff8a2374f5015061c7219063eb5cd947 (diff)
Major restructuring.
-rw-r--r--toolkit/test/accessibility/AccTreeNode.java34
-rwxr-xr-xtoolkit/test/accessibility/AccessibilityTree.java215
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java744
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModelBase.java107
-rwxr-xr-xtoolkit/test/accessibility/AccessibilityWorkBench.java286
-rw-r--r--toolkit/test/accessibility/AccessibleCellHandler.java17
-rw-r--r--toolkit/test/accessibility/AccessibleContextHandler.java115
-rw-r--r--toolkit/test/accessibility/AccessibleRelationHandler.java11
-rw-r--r--toolkit/test/accessibility/AccessibleTreeHandler.java4
-rw-r--r--toolkit/test/accessibility/AccessibleTreeNode.java6
-rwxr-xr-xtoolkit/test/accessibility/Canvas.java187
-rw-r--r--toolkit/test/accessibility/ChildEventHandler.java46
-rw-r--r--toolkit/test/accessibility/ContextEventHandler.java50
-rw-r--r--toolkit/test/accessibility/EventHandler.java56
-rw-r--r--toolkit/test/accessibility/EventListener.java125
-rw-r--r--toolkit/test/accessibility/EventLogger.java25
-rw-r--r--toolkit/test/accessibility/EventQueue.java119
-rw-r--r--toolkit/test/accessibility/GeometryEventHandler.java26
-rwxr-xr-xtoolkit/test/accessibility/InformationWriter.java124
-rw-r--r--toolkit/test/accessibility/MessageArea.java120
-rw-r--r--toolkit/test/accessibility/NodeFactory.java145
-rw-r--r--toolkit/test/accessibility/NodeHandler.java5
-rw-r--r--toolkit/test/accessibility/NodeMap.java112
-rwxr-xr-xtoolkit/test/accessibility/OfficeConnection.java11
-rw-r--r--toolkit/test/accessibility/QueuedListener.java58
-rw-r--r--toolkit/test/accessibility/QueuedTopWindowListener.java93
-rwxr-xr-xtoolkit/test/accessibility/SimpleOffice.java68
-rw-r--r--toolkit/test/accessibility/TableEventHandler.java43
-rw-r--r--toolkit/test/accessibility/TextLogger.java30
-rw-r--r--toolkit/test/accessibility/TopWindowListener.java56
-rw-r--r--toolkit/test/accessibility/makefile.mk83
31 files changed, 1752 insertions, 1369 deletions
diff --git a/toolkit/test/accessibility/AccTreeNode.java b/toolkit/test/accessibility/AccTreeNode.java
index 2c041030f2fb..1ce85b68eb2d 100644
--- a/toolkit/test/accessibility/AccTreeNode.java
+++ b/toolkit/test/accessibility/AccTreeNode.java
@@ -174,6 +174,29 @@ class AccTreeNode
return null;
}
+ public AccessibleTreeNode getChildNoCreate (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ if( nIndex >= 0 )
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ // check if this handler has the child, and if not
+ // search with next handler
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if (nIndex < aDescriptor.mnChildCount)
+ return aDescriptor.maHandler.getChildNoCreate (this, nIndex);
+ else
+ nIndex -= aDescriptor.mnChildCount;
+ }
+ }
+ else
+ throw new IndexOutOfBoundsException();
+
+ // nothing found?
+ return null;
+ }
+
public boolean removeChild (int nIndex)
throws IndexOutOfBoundsException
{
@@ -230,7 +253,7 @@ class AccTreeNode
public boolean equals (Object aOther)
{
- return (this == aOther) || aOther.equals(mxContext);
+ return (this == aOther) || (aOther!=null && aOther.equals(mxContext));
}
@@ -297,9 +320,12 @@ class AccTreeNode
The returned array containes the indices of the updated children
and can be used to create a TreeModelEvent.
*/
- public Vector update (java.lang.Class class1)
- {return update (class1, null); }
- public Vector update (java.lang.Class class1, java.lang.Class class2)
+ public Vector updateChildren (java.lang.Class class1)
+ {
+ return updateChildren (class1, null);
+ }
+
+ public Vector updateChildren (java.lang.Class class1, java.lang.Class class2)
{
Vector aChildIndices = new Vector();
int nOffset = 0;
diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java
index 518a039483fc..7af9c6f024da 100755
--- a/toolkit/test/accessibility/AccessibilityTree.java
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -1,19 +1,4 @@
-import drafts.com.sun.star.accessibility.XAccessible;
-import drafts.com.sun.star.accessibility.XAccessibleContext;
-import drafts.com.sun.star.accessibility.XAccessibleComponent;
-import drafts.com.sun.star.accessibility.XAccessibleExtendedComponent;
-import drafts.com.sun.star.accessibility.XAccessibleAction;
-import drafts.com.sun.star.accessibility.XAccessibleImage;
-import drafts.com.sun.star.accessibility.XAccessibleRelationSet;
-import drafts.com.sun.star.accessibility.XAccessibleStateSet;
-import drafts.com.sun.star.accessibility.XAccessibleText;
-import drafts.com.sun.star.accessibility.XAccessibleEditableText;
-import drafts.com.sun.star.accessibility.AccessibleTextType;
-import drafts.com.sun.star.accessibility.XAccessibleEventListener;
-import drafts.com.sun.star.accessibility.XAccessibleEventBroadcaster;
-import drafts.com.sun.star.accessibility.AccessibleEventObject;
-import drafts.com.sun.star.accessibility.AccessibleEventId;
-
+import drafts.com.sun.star.accessibility.*;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.IndexOutOfBoundsException;
import com.sun.star.uno.UnoRuntime;
@@ -25,10 +10,6 @@ import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
-// JDK 1.4.
-// import java.util.regex.Pattern;
-// import java.util.regex.Matcher;
-
/** This class is a start to collect the handling of a JTree and a DefaultTreeModel.
@@ -41,18 +22,11 @@ public class AccessibilityTree
for displaying messages and the specified canvas to draw the
graphical representations of accessible objects on.
*/
- public AccessibilityTree (
- MessageInterface aMessageDisplay,
- Print aPrinter)
+ public AccessibilityTree ()
{
- maMessageDisplay = aMessageDisplay;
- maPrinter = aPrinter;
-
AccessibilityTreeModel aModel =
new AccessibilityTreeModel (
- new StringNode ("Please press Update button", null),
- aMessageDisplay,
- aPrinter);
+ new StringNode ("Please press Update button", null));
setModel (aModel);
maCellRenderer = new AccessibleTreeCellRenderer();
@@ -77,7 +51,6 @@ public class AccessibilityTree
if (mnExpandLevel == 0)
{
setCursor (new Cursor (Cursor.WAIT_CURSOR));
- message ("expanding node ");
}
mnExpandLevel += 1;
}
@@ -85,7 +58,6 @@ public class AccessibilityTree
{
if (mnExpandLevel == 0)
{
- message ("collapsing node ");
setCursor (new Cursor (Cursor.WAIT_CURSOR));
}
mnExpandLevel += 1;
@@ -95,7 +67,6 @@ public class AccessibilityTree
mnExpandLevel -= 1;
if (mnExpandLevel == 0)
{
- message ("");
setCursor (new Cursor (Cursor.DEFAULT_CURSOR));
}
}
@@ -104,7 +75,6 @@ public class AccessibilityTree
mnExpandLevel -= 1;
if (mnExpandLevel == 0)
{
- message ("");
setCursor (new Cursor (Cursor.DEFAULT_CURSOR));
}
}
@@ -152,7 +122,6 @@ public class AccessibilityTree
{
if (mnExpandLevel == 0)
{
- message ("Expanding tree");
setEnabled (false);
}
mnExpandLevel += 1;
@@ -173,7 +142,6 @@ public class AccessibilityTree
{
setEnabled (true);
((AccessibilityTreeModel)getModel()).unlock (aNode);
- message ("");
}
}
@@ -246,17 +214,21 @@ public class AccessibilityTree
- protected void message (String message)
- {
- maMessageDisplay.message (message);
- }
-
public void disposing (com.sun.star.lang.EventObject e)
{
System.out.println ("disposing " + e);
}
+ public Dimension getPreferredSize ()
+ {
+ Dimension aPreferredSize = super.getPreferredSize();
+ Dimension aMinimumSize = super.getMinimumSize();
+ if (aPreferredSize.width < aMinimumSize.width)
+ aPreferredSize.width = aMinimumSize.width;
+ return aPreferredSize;
+ }
+
class MouseListener extends MouseAdapter
{
@@ -375,172 +347,11 @@ public class AccessibilityTree
}
- /** listen to tree model changes in order to update XAccessibleText objects
- */
- class TextUpdateListener implements TreeModelListener
- {
- public void treeNodesChanged(TreeModelEvent e)
- {
- // if the change is to the first child of a DefaultMutableTreeNode
- // with an XAccessibleText child, then we call updateText
- int[] aIndices = e.getChildIndices();
- if( (aIndices != null) &&
- (aIndices.length > 0) )
- {
- // we have a parent... lets check for XAccessibleText then
- DefaultMutableTreeNode aParent = (DefaultMutableTreeNode)
- (e.getTreePath().getLastPathComponent());
- DefaultMutableTreeNode aNode = (DefaultMutableTreeNode)
- (aParent.getChildAt(aIndices[0]));
- if( aParent.getUserObject() instanceof XAccessibleText)
- {
- // aha! we have an xText. So we can now check for
- // the various cases we support
- XAccessibleText xText =
- (XAccessibleText)aParent.getUserObject();
-
- if( aIndices[0] == 0 )
- {
- // first child! Then we call updateText
- updateText( xText, aNode.toString() );
- }
- else
- {
-// JDK 1.4:
-// // check for pattern "Selection:"
-// Matcher m = Pattern.compile(
-// "selection: \\[(-?[0-9]+),(-?[0-9]+)\\] \".*" ).
-// matcher( aNode.toString() );
-// if( m.matches() )
-// {
-// try
-// {
-// // aha! Selection:
-// setSelection( xText,
-// Integer.parseInt(m.group(1)),
-// Integer.parseInt(m.group(2)) );
-// }
-// catch( NumberFormatException f )
-// {
-// // ignore
-// }
-// }
- }
- }
- }
- }
- // don't care:
- public void treeNodesInserted(TreeModelEvent e) { ; }
- public void treeNodesRemoved(TreeModelEvent e) { ; }
- public void treeStructureChanged(TreeModelEvent e) { ; }
-
- /** update the text */
- boolean updateText( XAccessibleText xText, String sNew )
- {
- // is this text editable? if not, fudge you and return
- XAccessibleEditableText xEdit =
- (XAccessibleEditableText) UnoRuntime.queryInterface (
- XAccessibleEditableText.class, xText);
- if (xEdit == null)
- return false;
-
- String sOld = xText.getText();
-
- // false alarm? Early out if no change was done!
- if( sOld.equals( sNew ) )
- return false;
-
- // get the minimum length of both strings
- int nMinLength = sOld.length();
- if( sNew.length() < nMinLength )
- nMinLength = sNew.length();
-
- // count equal characters from front and end
- int nFront = 0;
- while( (nFront < nMinLength) &&
- (sNew.charAt(nFront) == sOld.charAt(nFront)) )
- nFront++;
- int nBack = 0;
- while( (nBack < nMinLength) &&
- ( sNew.charAt(sNew.length()-nBack-1) ==
- sOld.charAt(sOld.length()-nBack-1) ) )
- nBack++;
- if( nFront + nBack > nMinLength )
- nBack = nMinLength - nFront;
-
- // so... the first nFront and the last nBack characters
- // are the same. Change the others!
- String sDel = sOld.substring( nFront, sOld.length() - nBack );
- String sIns = sNew.substring( nFront, sNew.length() - nBack );
-
- System.out.println("edit text: " +
- sOld.substring(0, nFront) +
- " [ " + sDel + " -> " + sIns + " ] " +
- sOld.substring(sOld.length() - nBack) );
-
- boolean bRet = false;
- try
- {
- // edit the text, and use
- // (set|insert|delete|replace)Text as needed
- if( nFront+nBack == 0 )
- bRet = xEdit.setText( sIns );
- else if( sDel.length() == 0 )
- bRet = xEdit.insertText( sIns, nFront );
- else if( sIns.length() == 0 )
- bRet = xEdit.deleteText( nFront, sOld.length()-nBack );
- else
- bRet = xEdit.replaceText(nFront, sOld.length()-nBack,sIns);
- }
- catch( IndexOutOfBoundsException e )
- {
- bRet = false;
- }
-
- return bRet;
- }
-
- boolean setSelection( XAccessibleText xText, int p1, int p2 )
- {
- try
- {
- return xText.setSelection( p1, p2 );
- }
- catch( com.sun.star.lang.IndexOutOfBoundsException f )
- {
- return false;
- }
- }
-
-// /** replace the given node with a new xText node */
-// void updateNode( XAccessibleText xText,
-// DefaultMutableTreeNode aNode )
-// {
-// // create a new node
-// DefaultMutableTreeNode aNew = newTextTreeNode( xText );
-//
-// // get parent (must be DefaultMutableTreeNode)
-// DefaultMutableTreeNode aParent =
-// (DefaultMutableTreeNode)aNode.getParent();
-// if( aParent != null )
-// {
-// // remove old sub-tree, and insert new one
-// int nIndex = aParent.getIndex( aNode );
-// aParent.remove( nIndex );
-// aParent.insert( aNew, nIndex );
-// }
-// }
- }
-
-
- protected MessageInterface
- maMessageDisplay;
- protected Print
- maPrinter;
protected AccessibleTreeCellRenderer
maCellRenderer;
+
private Canvas
maCanvas;
private boolean
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
index 8c6fce5a4d49..fe7e545797b8 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModel.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -1,13 +1,11 @@
-
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreePath;
+
import java.util.Vector;
import java.util.HashMap;
import java.util.Enumeration;
-import java.util.LinkedList;
import drafts.com.sun.star.accessibility.*;
@@ -19,62 +17,24 @@ import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XServiceName;
public class AccessibilityTreeModel
- implements TreeModel, XAccessibleEventListener
+ extends AccessibilityTreeModelBase
{
- // Map to translate from accessible object to corresponding tree node.
- protected HashMap maXAccessibleToNode;
-
- // Making both of these static is clearly a hack.
- protected static MessageInterface maMessageArea;
- protected static Print maPrinter;
- protected static boolean mbVerbose = true;
-
- // If the lock count is higher then zero, then no events are processed.
- private int mnLockCount;
-
- // The list of TreeModelListener objects.
- private Vector maTMListeners;
-
- // The root node of the tree. Use setRoot to change it.
- private AccessibleTreeNode maRoot = null;
-
- // default handlers
- private static Vector aDefaultHandlers;
- private static NodeHandler maContextHandler = new AccessibleContextHandler();
- private static NodeHandler maTextHandler = new AccessibleTextHandler();
- private static NodeHandler maEditableTextHandler = new AccessibleEditableTextHandler();
- private static NodeHandler maComponentHandler = new AccessibleComponentHandler();
- private static NodeHandler maExtendedComponentHandler = new AccessibleExtendedComponentHandler();
- private static NodeHandler maActionHandler = new AccessibleActionHandler();
- private static NodeHandler maImageHandler = new AccessibleImageHandler();
- private static NodeHandler maTableHandler = new AccessibleTableHandler();
- private static NodeHandler maCellHandler = new AccessibleCellHandler();
- private static NodeHandler maHypertextHandler = new AccessibleHypertextHandler();
- private static NodeHandler maHyperlinkHandler = new AccessibleHyperlinkHandler();
- private static NodeHandler maSelectionHandler = new AccessibleSelectionHandler();
- private static NodeHandler maRelationHandler = new AccessibleRelationHandler();
- private static NodeHandler maTreeHandler = new AccessibleTreeHandler();
- private static NodeHandler maUNOHandler = new AccessibleUNOHandler();
-
- private Canvas maCanvas;
-
-
- public AccessibilityTreeModel (AccessibleTreeNode aRoot, MessageInterface aMessageArea, Print aPrinter)
+ public AccessibilityTreeModel (AccessibleTreeNode aRoot)
{
// create default node (unless we have a 'proper' node)
if( ! (aRoot instanceof AccessibleTreeNode) )
aRoot = new StringNode ("Root", null);
setRoot (aRoot);
- maMessageArea = aMessageArea;
- maPrinter = aPrinter;
- maTMListeners = new Vector();
- maXAccessibleToNode = new HashMap ();
+ maNodeMap = new NodeMap();
- // syncronous or asyncronous event delivery? (i.e. same thread
- // or in s seperate event delivery thread)
- // xListener = this; // syncronous event delivery
- xListener = new QueuedListener(); // asyncronous event delivery
+ maEventListener = new EventListener (this);
+ mxListener = new QueuedListener (maEventListener);
+ }
+
+ public void clear ()
+ {
+ maNodeMap.Clear();
}
/** Lock the tree. While the tree is locked, events from the outside are
@@ -117,117 +77,52 @@ public class AccessibilityTreeModel
- public Object getRoot()
- {
- return maRoot;
- }
public synchronized void setRoot (AccessibleTreeNode aRoot)
{
- if (maRoot == null)
- maRoot = aRoot;
+ if (getRoot() == null)
+ super.setRoot (aRoot);
else
{
lock ();
- clear ();
- maRoot = aRoot;
- unlock (maRoot);
+ maNodeMap.ForEach (new NodeMapCallback () {
+ public void Apply (AccTreeNode aNode)
+ {
+ if (maCanvas != null)
+ maCanvas.removeNode (aNode);
+ removeAccListener ((AccTreeNode)aNode);
+ }
+ });
+ maNodeMap.Clear ();
+
+ setRoot (aRoot);
+ unlock (aRoot);
}
}
- /** Clears the model. That removes all nodes from the internal structures.
- */
- public void clear ()
- {
- System.out.println ("clearing the whole tree");
- Object[] aNodes = maXAccessibleToNode.values().toArray();
- for (int i=0; i<aNodes.length; i++)
- removeNode ((AccessibleTreeNode)aNodes[i]);
- }
//
// child management:
//
- public int getChildCount(Object aParent)
- {
- return (aParent instanceof AccessibleTreeNode) ?
- ((AccessibleTreeNode)aParent).getChildCount() : 0;
- }
- public Object getChild (Object aParent, int nIndex)
- {
- Object aChild = null;
- try
- {
- if (aParent instanceof AccessibleTreeNode)
- aChild = getChild ((AccessibleTreeNode)aParent, nIndex);
- else
- System.out.println ("getChild called for unknown parent node");
- }
- catch (com.sun.star.lang.IndexOutOfBoundsException e)
- {
- aChild = ("no child " + nIndex + " from " + aParent + ": " + e);
- }
- return aChild;
- }
/** Delegate the request to the parent and then register listeners at
the child and add the child to the canvas.
*/
- public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
- throws com.sun.star.lang.IndexOutOfBoundsException
+ public Object getChild (Object aParent, int nIndex)
{
- AccessibleTreeNode aChild = null;
- if (aParent != null)
- aChild = aParent.getChild(nIndex);
-
- // Keep translation table up-to-date.
- addNode (aChild);
+ AccessibleTreeNode aChild = (AccessibleTreeNode)super.getChild (aParent, nIndex);
if (aChild == null)
System.out.println ("getChild: child not found");
+ else
+ // Keep translation table up-to-date.
+ addNode (aChild);
return aChild;
}
- /** iterate over all children and look for child */
- public int getIndexOfChild (Object aParent, Object aChild)
- {
- int nIndex = -1;
- try
- {
- if ((aParent instanceof AccessibleTreeNode) && (aChild instanceof AccessibleTreeNode))
- {
- AccessibleTreeNode aParentNode = (AccessibleTreeNode) aParent;
- AccessibleTreeNode aChildNode = (AccessibleTreeNode) aChild;
-
- int nChildCount = aParentNode.getChildCount();
- for( int i = 0; i < nChildCount; i++ )
- {
- if (aChildNode.equals (aParentNode.getChild (i)))
- {
- nIndex = i;
- break;
- }
- }
- }
- }
- catch (com.sun.star.lang.IndexOutOfBoundsException e)
- {
- // Return -1 by falling through.
- }
-
- // not found?
- return nIndex;
- }
-
-
- public boolean isLeaf (Object aNode)
- {
- return (aNode instanceof AccessibleTreeNode) ?
- ((AccessibleTreeNode)aNode).isLeaf() : true;
- }
@@ -246,7 +141,7 @@ public class AccessibilityTreeModel
{
// depth-first removal of children
while (aNode.getChildCount() > 0)
- if ( ! removeChild (aNode.getChild (0)))
+ if ( ! removeChild (aNode.getChildNoCreate (0)))
break;
// Remove node from its parent.
@@ -257,7 +152,7 @@ public class AccessibilityTreeModel
aParent.removeChild (nIndex);
}
- removeNode (aNode);
+ maNodeMap.RemoveNode (aNode);
}
}
catch (Exception e)
@@ -270,26 +165,21 @@ public class AccessibilityTreeModel
return true;
}
- protected void removeNode (AccessibleTreeNode aNode)
+ public void removeNode (XAccessibleContext xNode)
{
- try
+ if (xNode != null)
{
- if ((aNode != null) && (aNode instanceof AccTreeNode))
- {
- // Remove node itself from internal data structures.
- removeFromCanvas ((AccTreeNode)aNode);
- removeAccListener ((AccTreeNode)aNode);
- maXAccessibleToNode.remove (((AccTreeNode)aNode).getAccessible());
- }
- }
- catch (Exception e)
- {
- System.out.println ("caught exception while removing node "
- + aNode + " : " + e);
- e.printStackTrace();
+ AccessibleTreeNode aNode = maNodeMap.GetNode (xNode);
+ AccessibleTreeNode aRootNode = (AccessibleTreeNode)getRoot();
+ TreeModelEvent aEvent = createEvent (aRootNode, aNode);
+ removeChild (aNode);
+ System.out.println (aNode);
+ fireTreeNodesRemoved (aEvent);
+ maCanvas.repaint ();
}
}
+
/** Add add a new child to a parent.
@return
Returns the new or existing representation of the specified
@@ -304,7 +194,7 @@ public class AccessibilityTreeModel
// First make sure that the accessible object does not already have
// a representation.
- aChildNode = (AccessibleTreeNode)maXAccessibleToNode.get (xNewChild);
+ aChildNode = maNodeMap.GetNode(xNewChild);
if (aChildNode == null)
aChildNode = aParentNode.addAccessibleChild (xNewChild);
else
@@ -319,6 +209,31 @@ public class AccessibilityTreeModel
return aChildNode;
}
+ public void addChild (XAccessibleContext xParent, XAccessible xChild)
+ {
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
+ if (aParentNode instanceof AccTreeNode)
+ {
+ AccessibleTreeNode aChild = addChild ((AccTreeNode)aParentNode, xChild);
+ if (addNode (aChild))
+ {
+ if (maCanvas != null)
+ maCanvas.updateNode ((AccTreeNode)aParentNode);
+
+ // A call to fireTreeNodesInserted for xNew
+ // should be sufficient but at least the
+ // StringNode object that contains the number of
+ // children also changes and we do not know its
+ // index relative to its parent. Therefore the
+ // more expensive fireTreeStructureChanged is
+ // necessary.
+ fireTreeNodesInserted (createEvent (xParent, xChild));
+ updateNode (xParent, AccessibleTreeHandler.class);
+ }
+ maCanvas.repaint ();
+ }
+ }
+
/** Add the child node to the internal tree structure.
@param aNode
@@ -329,15 +244,16 @@ public class AccessibilityTreeModel
boolean bRet = false;
try
{
- if (aNode instanceof AccTreeNode)
+ if ( ! maNodeMap.ValueIsMember (aNode))
{
- AccTreeNode aChild = (AccTreeNode)aNode;
- XAccessible xChild = aChild.getAccessible();
- if (maXAccessibleToNode.get (xChild) == null)
+ if (aNode instanceof AccTreeNode)
{
+ AccTreeNode aChild = (AccTreeNode)aNode;
+ XAccessibleContext xChild = aChild.getContext();
registerAccListener (aChild);
- maXAccessibleToNode.put (xChild, aChild);
- addToCanvas (aChild);
+ if (maCanvas != null)
+ maCanvas.addNode (aChild);
+ maNodeMap.InsertNode (xChild, aChild);
}
bRet = true;
}
@@ -355,13 +271,6 @@ public class AccessibilityTreeModel
- /** Return the tree node that is associated with the given accessible object.
- */
- public AccessibleTreeNode getNode (XAccessible xAccessible)
- {
- return (AccessibleTreeNode)maXAccessibleToNode.get (xAccessible);
- }
-
/** create path to node, suitable for TreeModelEvent constructor
* @see javax.swing.event.TreeModelEvent#TreeModelEvent
*/
@@ -379,19 +288,8 @@ public class AccessibilityTreeModel
// tree cache, and we should get removed as soon as they are out.
//
- public void addTreeModelListener(TreeModelListener l)
- {
- maTMListeners.add(l);
- }
-
- public void removeTreeModelListener(TreeModelListener l)
- {
- maTMListeners.remove(l);
- }
-
protected void fireTreeNodesChanged(TreeModelEvent e)
{
- System.out.println("treeNodesChanges: " + e);
for(int i = 0; i < maTMListeners.size(); i++)
{
((TreeModelListener)maTMListeners.get(i)).treeNodesChanged(e);
@@ -400,7 +298,6 @@ public class AccessibilityTreeModel
protected void fireTreeNodesInserted(final TreeModelEvent e)
{
- System.out.println("treeNodesInserted: " + e);
for(int i = 0; i < maTMListeners.size(); i++)
{
((TreeModelListener)maTMListeners.get(i)).treeNodesInserted(e);
@@ -409,7 +306,6 @@ public class AccessibilityTreeModel
protected void fireTreeNodesRemoved(final TreeModelEvent e)
{
- System.out.println("treeNodesRemoved: " + e);
for(int i = 0; i < maTMListeners.size(); i++)
{
((TreeModelListener)maTMListeners.get(i)).treeNodesRemoved(e);
@@ -418,33 +314,32 @@ public class AccessibilityTreeModel
protected void fireTreeStructureChanged(final TreeModelEvent e)
{
- System.out.println("treeStructureChanged: " + e);
for(int i = 0; i < maTMListeners.size(); i++)
{
((TreeModelListener)maTMListeners.get(i)).treeStructureChanged(e);
}
}
- protected TreeModelEvent createEvent (XAccessible xParent)
+ protected TreeModelEvent createEvent (XAccessibleContext xParent)
{
- AccessibleTreeNode aParentNode = (AccessibleTreeNode)maXAccessibleToNode.get (xParent);
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
return new TreeModelEvent (this, createPath (aParentNode));
}
/** Create a TreeModelEvent object that informs listeners that one child
has been removed from or inserted into its parent.
*/
- public TreeModelEvent createEvent (XAccessible xParent, XAccessible xChild)
+ public TreeModelEvent createEvent (XAccessibleContext xParent, XAccessible xChild)
{
- AccessibleTreeNode aParentNode = (AccessibleTreeNode)maXAccessibleToNode.get (xParent);
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
return createEvent (aParentNode, xParent);
}
- public TreeModelEvent createEvent (AccessibleTreeNode aParentNode, XAccessible xChild)
+ public TreeModelEvent createEvent (AccessibleTreeNode aParentNode, XAccessibleContext xChild)
{
AccessibleTreeNode aChildNode = null;
if (xChild != null)
- aChildNode = (AccessibleTreeNode)maXAccessibleToNode.get (xChild);
+ aChildNode = maNodeMap.GetNode (xChild);
return createEvent (aParentNode, aChildNode);
}
@@ -515,12 +410,6 @@ public class AccessibilityTreeModel
protected void fire( TreeModelListener l) { }
}
- /** The listener to be registered with the accessible objects.
- * Could be set to 'this' for same-thread event delivery, or to an
- * instance of QueuedListener for multi-threaded delivery. May
- * not be changed, since this would trip the
- * register/removeAccListener logic. */
- private final XAccessibleEventListener xListener;
protected XAccessibleEventBroadcaster getBroadcaster (Object aObject)
@@ -539,7 +428,7 @@ public class AccessibilityTreeModel
XAccessibleEventBroadcaster xBroadcaster = getBroadcaster( aObject );
if (xBroadcaster != null)
{
- xBroadcaster.addEventListener( xListener );
+ xBroadcaster.addEventListener( mxListener );
}
}
@@ -548,458 +437,67 @@ public class AccessibilityTreeModel
XAccessibleEventBroadcaster xBroadcaster = getBroadcaster( aObject );
if (xBroadcaster != null)
{
- xBroadcaster.removeEventListener( xListener );
+ xBroadcaster.removeEventListener( mxListener );
}
}
- //
- // tree model edit
- //
- public void valueForPathChanged(TreePath path, Object newValue) { }
-
-
- //
- // static methods + members for creating default nodes
- //
-
-
-
- /** add default handlers based on the supported interfaces */
- public static void addDefaultHandlers (AccTreeNode aNode, XAccessibleContext xContext)
- {
- if (false)
- {
- // Slow but complete version: try each handler type separately.
- aNode.addHandler (maContextHandler.createHandler (xContext));
- aNode.addHandler (maTextHandler.createHandler (xContext));
- aNode.addHandler (maEditableTextHandler.createHandler (xContext));
- aNode.addHandler (maComponentHandler.createHandler (xContext));
- aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
- aNode.addHandler (maActionHandler.createHandler (xContext));
- aNode.addHandler (maImageHandler.createHandler (xContext));
- aNode.addHandler (maTableHandler.createHandler (xContext));
- aNode.addHandler (maCellHandler.createHandler (xContext));
- aNode.addHandler (maHypertextHandler.createHandler (xContext));
- aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
- aNode.addHandler (maSelectionHandler.createHandler (xContext));
- aNode.addHandler (maRelationHandler.createHandler (xContext));
- aNode.addHandler (maUNOHandler.createHandler (xContext));
- aNode.addHandler (maTreeHandler.createHandler (xContext));
- }
- else
- {
- // Exploit dependencies between interfaces.
- NodeHandler aHandler;
- aNode.addHandler (maContextHandler.createHandler (xContext));
-
- aHandler = maTextHandler.createHandler (xContext);
- if (aHandler != null)
- {
- aNode.addHandler (aHandler);
- aNode.addHandler (maEditableTextHandler.createHandler (xContext));
- aNode.addHandler (maHypertextHandler.createHandler (xContext));
- aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
- }
- aHandler = maComponentHandler.createHandler (xContext);
- if (aHandler != null)
- {
- aNode.addHandler (aHandler);
- aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
- }
- aNode.addHandler (maActionHandler.createHandler (xContext));
- aNode.addHandler (maImageHandler.createHandler (xContext));
- aNode.addHandler (maTableHandler.createHandler (xContext));
- aNode.addHandler (maRelationHandler.createHandler (xContext));
- aNode.addHandler (maCellHandler.createHandler (xContext));
- aNode.addHandler (maSelectionHandler.createHandler (xContext));
- aNode.addHandler (maUNOHandler.createHandler (xContext));
- aNode.addHandler (maTreeHandler.createHandler (xContext));
- }
- }
- /** create a node with the default handlers */
- public static AccTreeNode createDefaultNode (XAccessible xAccessible, AccessibleTreeNode aParent)
+ public void setCanvas( Canvas aCanvas )
{
- // default: aObject + aDisplay
- String sDisplay;
-
- // if we are accessible, we use the context + name instead
- XAccessibleContext xContext = null;
- if (xAccessible != null)
- xContext = xAccessible.getAccessibleContext();
- if (xContext != null)
- {
- sDisplay = xContext.getAccessibleName();
- if (sDisplay.length()==0)
- {
- sDisplay = "<no name> Role: "
- + AccessibleContextHandler.GetRoleName (
- xContext.getAccessibleRole());
- }
- }
- else
- sDisplay = new String ("not accessible");
-
-
- // create node, and add default handlers
- AccTreeNode aNode = new AccTreeNode (xAccessible, xContext, sDisplay, aParent);
- AccessibilityTreeModel.addDefaultHandlers (aNode, xContext);
-
- if (mbVerbose)
- maPrinter.print (". ");
-
- if (aNode == null)
- System.out.println ("createDefaultNode == null");
- return aNode;
+ maCanvas = aCanvas;
}
-
- //
- // XAccessibleEventListener interface
- //
-
- private static String objectToString(Object aObject)
+ public void updateNode (XAccessibleContext xSource, java.lang.Class class1)
{
- if (aObject == null)
- return null;
- else
- return aObject.toString();
- /*
- if( aObject instanceof Any )
- aObject = ((Any)aObject).getObject();
-
- if( aObject instanceof XInterface )
- {
- XServiceInfo xInfo =
- (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class,
- aObject);
- aObject = (xInfo != null) ? xInfo.getImplementationName()
- : aObject.getClass().toString();
- }
-
- return (aObject != null) ? aObject.toString() : null;
- */
+ updateNode (xSource, class1,null);
}
- public void disposing( EventObject aEvent)
- {
- System.out.println("dispose: " + objectToString(aEvent.Source));
- removeChild ((AccessibleTreeNode)maXAccessibleToNode.get (aEvent.Source));
- /*
- if( knowsNode( aEvent.Source ) )
- {
- System.out.println("ERROR: Dispose for living node called! " +
- "Maybe notifications don't work?");
- removeNode( aEvent.Source );
-// fireTreeStructureChanged( createEvent( getRoot() ) );
- }
- */
- }
- private void handleEvent (XAccessible xSource, java.lang.Class class1)
- { handleEvent (xSource, class1,null); }
- private void handleEvent (XAccessible xSource, java.lang.Class class1, java.lang.Class class2)
+ /** Get a list of children of the node associated with xSource that are
+ affected by the given handlers. Fire events that these children may
+ have changed in the tree view. Update the canvas representation of
+ xSource.
+ */
+ public void updateNode (XAccessibleContext xSource,
+ java.lang.Class class1, java.lang.Class class2)
{
- AccessibleTreeNode aNode = (AccessibleTreeNode)maXAccessibleToNode.get (xSource);
+ AccessibleTreeNode aNode = maNodeMap.GetNode (xSource);
+ System.out.println ("updateing node " + xSource + " " + aNode);
if (aNode instanceof AccTreeNode)
{
- Vector aChildIndices = ((AccTreeNode)aNode).update (
+ // Get list of affected children.
+ Vector aChildIndices = ((AccTreeNode)aNode).updateChildren (
class1, class2);
+ // Fire events that these children may have changed.
fireTreeNodesChanged (
createChangeEvent ((AccTreeNode)aNode, aChildIndices));
- updateOnCanvas ((AccTreeNode)aNode);
- maCanvas.repaint ();
- }
- }
-
- static final String[] aEventNames =
- {
- "[UNKNOWN]", "ACTION", "ACTIVE_DESCENDANT", "CARET", "CHILD",
- "DESCRIPTION", "HYPERTEXT_OFFSET", "NAME", "SELECTION", "STATE",
- "TABLE_CAPTION_CHANGED", "TABLE_COLUMN_DESCRIPTION_CHANGED",
- "TABLE_COLUMN_HEADER_CHANGED", "TABLE_MODEL_CHANGED",
- "TABLE_ROW_DESCRIPTION_CHANGED", "TABLE_ROW_HEADER_CHANGED",
- "TABLE_SUMMARY_CHANGED", "TEXT", "VALUE", "VISIBLE_DATA",
- "CONTROLLED_BY_PROPERTY", "CONTROLLER_FOR_PROPERTY",
- "LABEL_FOR_PROPERTY", "LABELED_BY_PROPERTY", "MEMBER_OF_PROPERTY",
- "CONTENT_FLOWS_FROM", "CONTENT_FLOWS_TO",
- "[UNKNOWN]"
- };
-
- /** This method is called from accessible objects that broadcast
- modifications of themselves or from their children. The event is
- processed only, except printing some messages, if the tree is not
- locked. It should be locked during changes to its internal
- structure like expanding nodes.
- */
- public void notifyEvent( AccessibleEventObject aEvent )
- {
-
- int nId = aEvent.EventId;
- if( (nId < 0) || (nId >= aEventNames.length) )
- nId = 0;
-
- System.out.println( "notify: " + aEvent.EventId + " "
- + aEventNames[nId] + ": ["
- + objectToString(aEvent.Source) + "] "
- + objectToString(aEvent.OldValue) + "->"
- + objectToString(aEvent.NewValue) );
-
- if (mnLockCount > 0)
- {
- System.out.println ("ignoring event because tree is locked");
- return;
- }
-
- XAccessible xSource = (XAccessible)UnoRuntime.queryInterface(
- XAccessible.class,aEvent.Source);
-
- switch( aEvent.EventId )
- {
- case AccessibleEventId.ACCESSIBLE_CHILD_EVENT:
- // fire insertion and deletion events:
- if (aEvent.OldValue != null)
- {
- XAccessible xOld = (XAccessible)UnoRuntime.queryInterface(
- XAccessible.class,aEvent.OldValue);
- // Create event before removing the node to get the old
- // index of the node.
- TreeModelEvent aRemoveEvent = createEvent (xSource, xOld);
- removeChild ((AccessibleTreeNode)maXAccessibleToNode.get (xOld));
- fireTreeNodesRemoved (aRemoveEvent);
- handleEvent (xSource, AccessibleTreeHandler.class);
- }
- // Insertion and removal of children should be mutually
- // exclusive. But then there is this 'should' ...
- if (aEvent.NewValue != null)
- {
- XAccessible xNew = (XAccessible)UnoRuntime.queryInterface(
- XAccessible.class,aEvent.NewValue);
- // Create event after inserting it so that its new index
- // in the parent can be determined.
- AccessibleTreeNode aParentNode = getNode (xSource);
- if (aParentNode instanceof AccTreeNode)
- {
- AccessibleTreeNode aChild = addChild ((AccTreeNode)aParentNode, xNew);
- if (addNode (aChild))
- {
- // ((AccTreeNode)aParentNode).update ();
- updateOnCanvas ((AccTreeNode)aParentNode);
-
- // A call to fireTreeNodesInserted for xNew
- // should be sufficient but at least the
- // StringNode object that contains the number of
- // children also changes and we do not know its
- // index relative to its parent. Therefore the
- // more expensive fireTreeStructureChanged is
- // necessary.
- fireTreeNodesInserted (createEvent (xSource, xNew));
- handleEvent (xSource, AccessibleTreeHandler.class);
- }
- }
- }
- maCanvas.repaint ();
- break;
-
- case AccessibleEventId.ACCESSIBLE_TABLE_MODEL_EVENT:
- AccessibleTableModelChange aModelChange = (AccessibleTableModelChange)aEvent.NewValue;
- System.out.println( "Range: StartRow " + aModelChange.FirstRow +
- " StartColumn " + aModelChange.FirstColumn +
- " EndRow " + aModelChange.LastRow +
- " EndColumn " + aModelChange.LastColumn +
- " Id " + aModelChange.Type);
- break;
-
- case AccessibleEventId.ACCESSIBLE_VISIBLE_DATA_EVENT:
- handleEvent (xSource,
- AccessibleComponentHandler.class,
- AccessibleExtendedComponentHandler.class);
- break;
-
-
- case AccessibleEventId.ACCESSIBLE_NAME_EVENT:
- case AccessibleEventId.ACCESSIBLE_DESCRIPTION_EVENT:
- case AccessibleEventId.ACCESSIBLE_STATE_EVENT:
- case AccessibleEventId.CONTROLLED_BY_EVENT:
- case AccessibleEventId.CONTROLLER_FOR_EVENT:
- case AccessibleEventId.LABEL_FOR_EVENT:
- case AccessibleEventId.LABELED_BY_EVENT:
- case AccessibleEventId.MEMBER_OF_EVENT:
- case AccessibleEventId.ACCESSIBLE_SELECTION_EVENT:
- handleEvent (xSource, AccessibleContextHandler.class);
- break;
-
- case AccessibleEventId.ACCESSIBLE_TABLE_CAPTION_EVENT:
- case AccessibleEventId.ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_EVENT:
- case AccessibleEventId.ACCESSIBLE_TABLE_COLUMN_HEADER_EVENT:
- case AccessibleEventId.ACCESSIBLE_TABLE_ROW_DESCRIPTION_EVENT:
- case AccessibleEventId.ACCESSIBLE_TABLE_ROW_HEADER_EVENT:
- case AccessibleEventId.ACCESSIBLE_TABLE_SUMMARY_EVENT:
- handleEvent (xSource, AccessibleTableHandler.class);
- break;
-
- case AccessibleEventId.ACCESSIBLE_ACTION_EVENT:
- handleEvent (xSource, AccessibleActionHandler.class);
- break;
-
- case AccessibleEventId.ACCESSIBLE_HYPERTEXT_EVENT:
- handleEvent (xSource, AccessibleHypertextHandler.class);
- break;
-
- case AccessibleEventId.ACCESSIBLE_ACTIVE_DESCENDANT_EVENT:
- case AccessibleEventId.ACCESSIBLE_CARET_EVENT:
- case AccessibleEventId.ACCESSIBLE_TEXT_EVENT:
- case AccessibleEventId.ACCESSIBLE_VALUE_EVENT:
- handleEvent (xSource, AccessibleTextHandler.class);
- break;
-
- default:
- break;
+ // Update the graphical representation of aNode in the Canvas.
+ if (maCanvas != null)
+ maCanvas.updateNode ((AccTreeNode)aNode);
+ maCanvas.repaint ();
}
}
+ // Making both of these static is clearly a hack.
+ protected static MessageInterface maMessageArea;
+ protected static Print maPrinter;
+ protected static boolean mbVerbose = true;
- //
- // canvas
- //
-
- public void setCanvas( Canvas aCanvas )
- {
- maCanvas = aCanvas;
- }
-
- protected void addToCanvas (AccTreeNode aNode)
- {
- if (maCanvas != null)
- maCanvas.addNode (aNode);
- }
-
- protected void removeFromCanvas (AccTreeNode aNode)
- {
- if (maCanvas != null)
- maCanvas.removeNode (aNode);
- }
-
- protected void updateOnCanvas (AccTreeNode aNode)
- {
- if (maCanvas != null)
- maCanvas.updateNode (aNode);
- }
-
-
-
-
-
- /** QueuedListener implements an AccessibleEventListener which
- * delegates all events to another such listener, but does so in a
- * seperate thread */
- class QueuedListener
- implements XAccessibleEventListener, Runnable
- {
- public QueuedListener()
- {
- System.out.println ("starting new queued listener");
-
- // initiate thread
- new Thread(this, "QueuedListener").start();
- }
-
- /** The queue of event objects, LinkedList<Runnable>
- * The queue object will also serve as lock for the
- * consumer/producer type syncronization.
- */
- protected LinkedList aQueue = new LinkedList();
-
- /// This thread's main method: deliver all events
- public void run()
- {
- // in an infinite loop, check for events to deliver, then
- // wait on lock (which will be notified when new events arrive)
- while( true )
- {
- Runnable aEvent = null;
- do
- {
- synchronized( aQueue )
- {
- aEvent = (aQueue.size() > 0) ?
- (Runnable)aQueue.removeFirst() : null;
- }
- if( aEvent != null )
- {
- System.out.println("Deliver event: " +
- aEvent.hashCode());
- try
- {
- aEvent.run();
- }
- catch( Throwable e )
- {
- System.out.println(
- "Exception during event delivery: " + e );
- e.printStackTrace();
- }
- }
- }
- while( aEvent != null );
-
- try
- {
- synchronized( aQueue )
- {
- aQueue.wait();
- }
- }
- catch( Exception e )
- {
- // can't wait? odd!
- System.err.println("Can't wait!");
- e.printStackTrace();
- }
- }
- }
+ /** The listener to be registered with the accessible objects.
+ * Could be set to 'this' for same-thread event delivery, or to an
+ * instance of QueuedListener for multi-threaded delivery. May
+ * not be changed, since this would trip the
+ * register/removeAccListener logic. */
+ private final XAccessibleEventListener mxListener;
+ // Map to translate from accessible object to corresponding tree node.
+ private NodeMap maNodeMap;
- public void disposing( final EventObject aEvent)
- {
- System.out.println( "Queue disposing: " + aEvent.hashCode() );
- synchronized( aQueue )
- {
- aQueue.addLast( new Runnable()
- {
- public void run()
- {
- AccessibilityTreeModel.this.disposing( aEvent );
- }
- public int hashCode()
- {
- return aEvent.hashCode();
- }
- } );
- aQueue.notify();
- }
- }
+ // If the lock count is higher then zero, then no events are processed.
+ private int mnLockCount;
- public void notifyEvent( final AccessibleEventObject aEvent )
- {
- System.out.println( "Queue notifyEvent: " + aEvent.hashCode() );
- synchronized( aQueue )
- {
- aQueue.addLast( new Runnable()
- {
- public void run()
- {
- AccessibilityTreeModel.this.notifyEvent( aEvent );
- }
- public int hashCode()
- {
- return aEvent.hashCode();
- }
- } );
- aQueue.notify();
- }
- }
- }
+ private Canvas maCanvas;
+ private EventListener maEventListener;
}
diff --git a/toolkit/test/accessibility/AccessibilityTreeModelBase.java b/toolkit/test/accessibility/AccessibilityTreeModelBase.java
new file mode 100644
index 000000000000..6452c604c1b4
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibilityTreeModelBase.java
@@ -0,0 +1,107 @@
+import javax.swing.tree.TreeModel;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreePath;
+import javax.swing.event.TreeModelEvent;
+import java.util.Vector;
+
+public class AccessibilityTreeModelBase
+ implements TreeModel
+{
+ public AccessibilityTreeModelBase ()
+ {
+ setRoot (null);
+ maTMListeners = new Vector();
+ }
+
+ public synchronized void addTreeModelListener(TreeModelListener l)
+ {
+ maTMListeners.add(l);
+ }
+
+ public synchronized void removeTreeModelListener(TreeModelListener l)
+ {
+ maTMListeners.remove(l);
+ }
+
+ public synchronized int getChildCount(Object aParent)
+ {
+ return (aParent instanceof AccessibleTreeNode) ?
+ ((AccessibleTreeNode)aParent).getChildCount() : 0;
+ }
+
+ public synchronized Object getChild (Object aParent, int nIndex)
+ {
+ Object aChild = null;
+ try
+ {
+ if (aParent != null && aParent instanceof AccessibleTreeNode)
+ aChild = ((AccessibleTreeNode)aParent).getChild(nIndex);
+ else
+ System.out.println ("getChild called for unknown parent node");
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ aChild = ("no child " + nIndex + " from " + aParent + ": " + e);
+ }
+ return aChild;
+ }
+
+ /** iterate over all children and look for child */
+ public synchronized int getIndexOfChild (Object aParent, Object aChild)
+ {
+ int nIndex = -1;
+ try
+ {
+ if ((aParent instanceof AccessibleTreeNode) && (aChild instanceof AccessibleTreeNode))
+ {
+ AccessibleTreeNode aParentNode = (AccessibleTreeNode) aParent;
+ AccessibleTreeNode aChildNode = (AccessibleTreeNode) aChild;
+
+ int nChildCount = aParentNode.getChildCount();
+ for( int i = 0; i < nChildCount; i++ )
+ {
+ if (aChildNode.equals (aParentNode.getChild (i)))
+ {
+ nIndex = i;
+ break;
+ }
+ }
+ }
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ // Return -1 by falling through.
+ }
+
+ // not found?
+ return nIndex;
+ }
+
+ public boolean isLeaf (Object aNode)
+ {
+ return (aNode instanceof AccessibleTreeNode) ?
+ ((AccessibleTreeNode)aNode).isLeaf() : true;
+ }
+
+
+
+ public synchronized Object getRoot()
+ {
+ return maRoot;
+ }
+
+ public void valueForPathChanged(TreePath path, Object newValue)
+ { }
+
+ protected synchronized void setRoot (AccessibleTreeNode aRoot)
+ {
+ maRoot = aRoot;
+ }
+
+
+ // The list of TreeModelListener objects.
+ protected Vector maTMListeners;
+
+ // The root node of the tree. Use setRoot to change it.
+ private AccessibleTreeNode maRoot = null;
+}
diff --git a/toolkit/test/accessibility/AccessibilityWorkBench.java b/toolkit/test/accessibility/AccessibilityWorkBench.java
index e9f3afa687e0..4e0fe33dbba4 100755
--- a/toolkit/test/accessibility/AccessibilityWorkBench.java
+++ b/toolkit/test/accessibility/AccessibilityWorkBench.java
@@ -36,14 +36,19 @@ import javax.swing.*;
import javax.swing.tree.*;
import java.io.*;
+/** This class manages the GUI of the work bench.
+ @see AccessibilityTreeModel
+ for the implementation of the tree view on the left side which also
+ manages the registration of accessibility listeners.
+ @see Canvas
+ for the graphical view of the accessible objects.
+*/
public class AccessibilityWorkBench
extends JFrame
implements ActionListener,
- Print,
- MessageInterface,
XTerminateListener
{
- public static final String msVersion = "v1.6";
+ public static final String msVersion = "v1.7";
public String msFileName;
public String msOptionsFileName = ".AWBrc";
@@ -98,13 +103,15 @@ public class AccessibilityWorkBench
msFileName = sFileName;
Layout ();
+ // EventLogger.Instance();
- println (System.getProperty ("os.name") + " / "
+ MessageArea.println (System.getProperty ("os.name") + " / "
+ System.getProperty ("os.arch") + " / "
+ System.getProperty ("os.version"));
- println ("Using port " + nPortNumber + " and document file name " + msFileName);
- office = new SimpleOffice (this, nPortNumber);
- info = new InformationWriter (this);
+ MessageArea.println ("Using port " + nPortNumber
+ + " and document file name " + msFileName);
+ office = new SimpleOffice (nPortNumber);
+ info = new InformationWriter ();
addWindowListener (new WindowAdapter ()
{ public void windowClosing (WindowEvent e)
@@ -129,81 +136,47 @@ public class AccessibilityWorkBench
getContentPane().setLayout (aLayout);
// Accessible Tree.
- maTree = new AccessibilityTree ((MessageInterface)this, (Print)this);
- aScrollPane = new JScrollPane(maTree,
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ maTree = new AccessibilityTree ();
+ maTree.setMinimumSize (new Dimension (250,300));
+ // maTree.setPreferredSize (new Dimension (300,500));
+ JScrollPane aTreeScrollPane = new JScrollPane(maTree,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
- constraints = new GridBagConstraints ();
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.gridwidth = 1;
- constraints.gridheight = 2;
- constraints.weightx = 2;
- constraints.weighty = 1;
- constraints.fill = GridBagConstraints.BOTH;
- getContentPane().add (aScrollPane, constraints);
// Canvas.
- maCanvas = new Canvas (this);
+ maCanvas = new Canvas ();
maCanvas.setTree (maTree);
maTree.SetCanvas (maCanvas);
- maCanvas.setPreferredSize (new Dimension (1000,800));
- aScrollPane = new JScrollPane(maCanvas,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS/*AS_NEEDED*/,
- JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS/*AS_NEEDED*/);
- constraints = new GridBagConstraints ();
- constraints.gridx = 1;
- constraints.gridy = 0;
- constraints.gridwidth = 1;
- constraints.gridheight = 1;
- constraints.weightx = 3;
- constraints.weighty = 3;
- constraints.fill = GridBagConstraints.BOTH;
- getContentPane().add (aScrollPane, constraints);
+ maCanvas.setPreferredSize (new Dimension (1000,1000));
+
+ // Split pane for tree view and canvas.
+ JSplitPane aViewSplitPane = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
+ aTreeScrollPane, maCanvas);
+ aViewSplitPane.setOneTouchExpandable(true);
+ aViewSplitPane.setDividerLocation (aTreeScrollPane.getPreferredSize().width);
// Text output area.
- maOutputArea = new JTextArea (5,50);
- maScrollPane = new JScrollPane(maOutputArea,
- JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
- JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
- constraints = new GridBagConstraints ();
- constraints.gridx = 1;
- constraints.gridy = 1;
- constraints.gridwidth = 1;
- constraints.gridheight = 1;
- constraints.weightx = 3;
- constraints.weighty = 1;
- constraints.fill = GridBagConstraints.BOTH;
- getContentPane().add (maScrollPane, constraints);
-
- // Message output area.
- maMessageArea = new JTextArea (5,20);
- constraints = new GridBagConstraints ();
- constraints.gridx = 0;
- constraints.gridy = 2;
- constraints.gridwidth = 2;
- constraints.gridheight = 1;
- constraints.weightx = 3;
- constraints.weighty = 0;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- getContentPane().add (maMessageArea, constraints);
+ maMessageArea = MessageArea.Instance ();
+ maMessageArea.setMinimumSize (new Dimension (50,50));
+ maMessageArea.setPreferredSize (new Dimension (300,100));
+
+ // Split pane for the two views and the message area.
+ JSplitPane aSplitPane = new JSplitPane (JSplitPane.VERTICAL_SPLIT,
+ aViewSplitPane, maMessageArea);
+ aSplitPane.setOneTouchExpandable(true);
+ addGridElement (aSplitPane, 0,0, 2,1, 3,3,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH);
+
// Button bar.
maButtonBar = new JPanel();
GridBagLayout aButtonLayout = new GridBagLayout ();
maButtonBar.setLayout (new FlowLayout());
- constraints = new GridBagConstraints ();
- constraints.gridx = 0;
- constraints.gridy = 3;
- constraints.gridwidth = 2;
- constraints.weightx = 1;
- constraints.anchor = GridBagConstraints.WEST;
- constraints.fill = GridBagConstraints.BOTH;
- getContentPane().add (maButtonBar, constraints);
+ addGridElement (maButtonBar, 0,3, 2,1, 1,0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
// Buttons.
aConnectButton = createButton ("Connect", "connect");
- aLoadButton = createButton ("Load", "load");
aUpdateButton = createButton ("Update", "update");
aShapesButton = createButton ("Expand Shapes", "shapes");
aExpandButton = createButton ("Expand All", "expand");
@@ -213,42 +186,40 @@ public class AccessibilityWorkBench
LoadOptions();
- // Menu bar.
- maMenuBar = new MenuBar ();
- setMenuBar (maMenuBar);
-
- // File menu.
- Menu aFileMenu = new Menu ("File");
- maMenuBar.add (aFileMenu);
- MenuItem aItem;
- aItem = new MenuItem ("Quit");
- aFileMenu.add (aItem);
- aItem.addActionListener (this);
-
- // Options menu.
- Menu aOptionsMenu = new Menu ("Options");
- maMenuBar.add (aOptionsMenu);
- CheckboxMenuItem aCBItem;
- aCBItem = new CheckboxMenuItem ("Show Descriptions", maCanvas.getShowDescriptions());
- aOptionsMenu.add (aCBItem);
- aCBItem.addActionListener (this);
-
- aCBItem = new CheckboxMenuItem ("Show Names", maCanvas.getShowNames());
- aOptionsMenu.add (aCBItem);
- aCBItem.addActionListener (this);
-
- aCBItem = new CheckboxMenuItem ("Antialiased Rendering", maCanvas.getAntialiasing());
- aOptionsMenu.add (aCBItem);
- aCBItem.addActionListener (this);
+ setJMenuBar (CreateMenuBar ());
setTitle("Accessibility Workbench " + msVersion);
pack ();
setVisible (true);
+ validate ();
repaint();
}
+
+
+ /** Shortcut method for adding an object to a GridBagLayout.
+ */
+ void addGridElement (JComponent object,
+ int x, int y, int width, int height, int weightx, int weighty,
+ int anchor, int fill)
+ {
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = x;
+ constraints.gridy = y;
+ constraints.gridwidth = width;
+ constraints.gridheight = height;
+ constraints.weightx = weightx;
+ constraints.weighty = weighty;
+ constraints.anchor = anchor;
+ constraints.fill = fill;
+ getContentPane().add (object, constraints);
+ }
+
+
+
+
/** Create a new button and place at the right most position into the
button bar.
*/
@@ -264,6 +235,48 @@ public class AccessibilityWorkBench
}
+
+
+ /** Create a menu bar for the application.
+ @return
+ Returns the new menu bar. The returned reference is also
+ remembered in the data member <member>maMenuBar</member>.
+ */
+ JMenuBar CreateMenuBar ()
+ {
+ // Menu bar.
+ maMenuBar = new JMenuBar ();
+
+ // File menu.
+ JMenu aFileMenu = new JMenu ("File");
+ maMenuBar.add (aFileMenu);
+ JMenuItem aItem;
+ aItem = new JMenuItem ("Quit");
+ aFileMenu.add (aItem);
+ aItem.addActionListener (this);
+
+ // Options menu.
+ JMenu aOptionsMenu = new JMenu ("Options");
+ maMenuBar.add (aOptionsMenu);
+ JCheckBoxMenuItem aCBItem;
+ aCBItem = new JCheckBoxMenuItem ("Show Descriptions", maCanvas.getShowDescriptions());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Show Names", maCanvas.getShowNames());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Antialiased Rendering", maCanvas.getAntialiasing());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ return maMenuBar;
+ }
+
+
+
+
protected void LoadOptions ()
{
try
@@ -331,6 +344,8 @@ public class AccessibilityWorkBench
}
}
+ catch (java.io.FileNotFoundException e)
+ {}
catch (Exception e)
{
System.out.println ("caught exception while loading options file : " + e);
@@ -370,11 +385,12 @@ public class AccessibilityWorkBench
maCanvas.clear();
AccessibilityTreeModel aModel = null;
- System.out.println ("creating new tree model");
- aModel = new AccessibilityTreeModel (createTreeModelRoot(), this, this);
+ aModel = new AccessibilityTreeModel (createTreeModelRoot());
+
aModel.setCanvas (maCanvas);
maTree.setModel (aModel);
+
if (office != null)
{
// Add terminate listener.
@@ -384,13 +400,14 @@ public class AccessibilityWorkBench
XExtendedToolkit xToolkit = office.getExtendedToolkit();
// Remove old top window listener.
if (maTopWindowListener != null)
- xToolkit.removeTopWindowListener (maTopWindowListener);
+ xToolkit.removeTopWindowListener (maQueuedTopWindowListener);
// Add top window listener.
if (xToolkit != null)
{
- println ("registering at extended toolkit");
+ MessageArea.println ("registering at extended toolkit");
maTopWindowListener = new TopWindowListener (aModel, office);
- xToolkit.addTopWindowListener (maTopWindowListener);
+ maQueuedTopWindowListener = new QueuedTopWindowListener (maTopWindowListener);
+ xToolkit.addTopWindowListener (maQueuedTopWindowListener);
maTopWindowListener.Initialize ();
}
else
@@ -411,7 +428,6 @@ public class AccessibilityWorkBench
{
aConnectButton.setEnabled (mbInitialized);
aQuitButton.setEnabled (mbInitialized);
- aLoadButton.setEnabled (mbInitialized);
aUpdateButton.setEnabled (mbInitialized);
aExpandButton.setEnabled (mbInitialized);
aShapesButton.setEnabled (mbInitialized);
@@ -419,6 +435,8 @@ public class AccessibilityWorkBench
}
+
+
/** Callback for GUI actions from the buttons.
*/
public void actionPerformed (java.awt.event.ActionEvent e)
@@ -434,18 +452,6 @@ public class AccessibilityWorkBench
aModel.clear();
System.exit (0);
}
- else if (e.getActionCommand().equals("load"))
- {
- print ("Loading file " + msFileName);
- mxModel = office.loadDocument (msFileName);
- if (mxModel == null)
- println (": could not be loaded");
- else
- {
- println (".");
- initialize();
- }
- }
else if (e.getActionCommand().equals("update"))
{
initialize ();
@@ -525,58 +531,22 @@ public class AccessibilityWorkBench
System.out.println("controller disposed");
}
- // XTerminateListener
- public void queryTermination (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Terminate Event : " + aEvent);
- }
-
- // XTerminateListener
- public void notifyTermination (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Notifiy Termination Event : " + aEvent);
- }
-
-
- /** Write message into message area.
- */
- public void message (String message)
- {
- msMessage = message;
- maMessageArea.setText (msMessage);
- // System.out.println (message);
-
- // Show the new message string immediately.
- maMessageArea.paintImmediately (maMessageArea.getVisibleRect());
- }
-
- public void message_append (String message)
- {
- msMessage += message;
- message (msMessage);
- }
-
-
-
-
- public void print (String text)
+ // XTerminateListener
+ public void queryTermination (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
{
- maOutputArea.append (text);
- maOutputArea.paintImmediately (maOutputArea.getVisibleRect());
+ System.out.println ("Terminate Event : " + aEvent);
}
- public void println (String text)
+ // XTerminateListener
+ public void notifyTermination (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
{
- maOutputArea.append (text + "\n");
- JScrollBar aBar = maScrollPane.getVerticalScrollBar();
- aBar.setValue (aBar.getMaximum());
- maOutputArea.paintImmediately (maOutputArea.getVisibleRect());
+ System.out.println ("Notifiy Termination Event : " + aEvent);
}
@@ -597,18 +567,16 @@ public class AccessibilityWorkBench
maTree;
private JScrollPane
maScrollPane;
- private JTextArea
- maOutputArea,
+ private MessageArea
maMessageArea;
private JButton
aConnectButton,
aQuitButton,
- aLoadButton,
aUpdateButton,
aExpandButton,
aShapesButton,
aTextButton;
- private MenuBar
+ private JMenuBar
maMenuBar;
private String
msMessage;
@@ -616,4 +584,6 @@ public class AccessibilityWorkBench
mbInitialized;
private TopWindowListener
maTopWindowListener;
+ private QueuedTopWindowListener
+ maQueuedTopWindowListener;
}
diff --git a/toolkit/test/accessibility/AccessibleCellHandler.java b/toolkit/test/accessibility/AccessibleCellHandler.java
index ee3657cd866d..4949f7a33cef 100644
--- a/toolkit/test/accessibility/AccessibleCellHandler.java
+++ b/toolkit/test/accessibility/AccessibleCellHandler.java
@@ -10,14 +10,17 @@ class AccessibleCellHandler extends NodeHandler
public NodeHandler createHandler (XAccessibleContext xContext)
{
AccessibleCellHandler aCellHandler = null;
- XAccessible xParent = xContext.getAccessibleParent();
- if (xParent != null)
+ if (xContext != null)
{
- XAccessibleTable xTable =
- (XAccessibleTable) UnoRuntime.queryInterface (
- XAccessibleTable.class, xParent.getAccessibleContext());
- if (xTable != null)
- aCellHandler = new AccessibleCellHandler (xTable);
+ XAccessible xParent = xContext.getAccessibleParent();
+ if (xParent != null)
+ {
+ XAccessibleTable xTable =
+ (XAccessibleTable) UnoRuntime.queryInterface (
+ XAccessibleTable.class, xParent.getAccessibleContext());
+ if (xTable != null)
+ aCellHandler = new AccessibleCellHandler (xTable);
+ }
}
return aCellHandler;
diff --git a/toolkit/test/accessibility/AccessibleContextHandler.java b/toolkit/test/accessibility/AccessibleContextHandler.java
index 750e567b7527..7df9713118da 100644
--- a/toolkit/test/accessibility/AccessibleContextHandler.java
+++ b/toolkit/test/accessibility/AccessibleContextHandler.java
@@ -10,117 +10,6 @@ class AccessibleContextHandler
{
protected int nChildrenCount;
- private static String maStateNames[] = {
- "INVALID", // 0
- "ACTIVE",
- "ARMED",
- "BUSY",
- "CHECKED",
- "COLLAPSED",
- "DEFUNC",
- "EDITABLE",
- "ENABLED",
- "EXPANDABLE",
- "EXPANDED", // 10
- "FOCUSABLE",
- "FOCUSED",
- "HORIZONTAL",
- "ICONIFIED",
- "MODAL",
- "MULTILINE",
- "MULTISELECTABLE",
- "OPAQUE",
- "PRESSED",
- "RESIZABLE", // 20
- "SELECTABLE",
- "SELECTED",
- "SENSITIVE",
- "SHOWING",
- "SINGLE_LINE",
- "STALE",
- "TRANSIENT",
- "VERTICAL",
- "VISIBLE",
- "MANAGES_DESCENDANT", // 30
- };
- private static HashMap maRoleMap = new HashMap();
- static
- {
- maRoleMap.put (new Integer(0),"UNKNOWN");
- maRoleMap.put (new Integer(1), "ALERT");
- maRoleMap.put (new Integer(2), "AWTCOMPONENT");
- maRoleMap.put (new Integer(3), "COLUMNHEADER");
- maRoleMap.put (new Integer(4), "CANVAS");
- maRoleMap.put (new Integer(5), "CHECKBOX");
- maRoleMap.put (new Integer(6), "COLORCHOOSER");
- maRoleMap.put (new Integer(7), "COMBOBOX");
- maRoleMap.put (new Integer(8), "DATEEDITOR");
- maRoleMap.put (new Integer(9), "DESKTOPICON");
- maRoleMap.put (new Integer(10), "DESKTOPPANE");
- maRoleMap.put (new Integer(11), "DIRECTORYPANE");
- maRoleMap.put (new Integer(12), "DIALOG");
- maRoleMap.put (new Integer(13), "FILECHOOSER");
- maRoleMap.put (new Integer(14), "FILLER");
- maRoleMap.put (new Integer(15), "FONTCHOOSER");
- maRoleMap.put (new Integer(16), "FRAME");
- maRoleMap.put (new Integer(17), "GLASSPANE");
- maRoleMap.put (new Integer(18), "GROUPBOX");
- maRoleMap.put (new Integer(19), "HYPERLINK");
- maRoleMap.put (new Integer(20), "ICON");
- maRoleMap.put (new Integer(21), "INTERNALFRAME");
- maRoleMap.put (new Integer(22), "LABEL");
- maRoleMap.put (new Integer(23), "LAYEREDPANE");
- maRoleMap.put (new Integer(24), "LIST");
- maRoleMap.put (new Integer(25), "LISTITEM");
- maRoleMap.put (new Integer(26), "MENU");
- maRoleMap.put (new Integer(27), "MENUBAR");
- maRoleMap.put (new Integer(28), "MENUITEM");
- maRoleMap.put (new Integer(29), "OPTIONPANE");
- maRoleMap.put (new Integer(30), "PAGETAB");
- maRoleMap.put (new Integer(31), "PAGETABLIST");
- maRoleMap.put (new Integer(32), "PANEL");
- maRoleMap.put (new Integer(33), "PASSWORDTEXT");
- maRoleMap.put (new Integer(34), "POPUPMENU");
- maRoleMap.put (new Integer(35), "PUSHBUTTON");
- maRoleMap.put (new Integer(36), "PROGRESSBAR");
- maRoleMap.put (new Integer(37), "RADIOBUTTON");
- maRoleMap.put (new Integer(38), "ROWHEADER");
- maRoleMap.put (new Integer(39), "ROOTPANE");
- maRoleMap.put (new Integer(40), "SCROLLBAR");
- maRoleMap.put (new Integer(41), "SCROLLPANE");
- maRoleMap.put (new Integer(42), "SEPARATOR");
- maRoleMap.put (new Integer(43), "SLIDER");
- maRoleMap.put (new Integer(44), "SPINBOX");
- maRoleMap.put (new Integer(45), "SPLITPANE");
- maRoleMap.put (new Integer(46), "STATUSBAR");
- maRoleMap.put (new Integer(47), "SWINGCOMPONENT");
- maRoleMap.put (new Integer(48), "TABLE");
- maRoleMap.put (new Integer(49), "TEXT");
- maRoleMap.put (new Integer(50), "TOGGLEBUTTON");
- maRoleMap.put (new Integer(51), "TOOLBAR");
- maRoleMap.put (new Integer(52), "TOOLTIP");
- maRoleMap.put (new Integer(53), "TREE");
- maRoleMap.put (new Integer(54), "VIEWPORT");
- maRoleMap.put (new Integer(55), "WINDOW");
- maRoleMap.put (new Integer(100), "DOCUMENT");
- maRoleMap.put (new Integer(101), "HEADER");
- maRoleMap.put (new Integer(102), "FOOTER");
- maRoleMap.put (new Integer(103), "PARAGRAPH");
- maRoleMap.put (new Integer(104), "HEADING");
- maRoleMap.put (new Integer(105), "TABLE_CELL");
- maRoleMap.put (new Integer(106), "TEXT_FRAME");
- maRoleMap.put (new Integer(107), "GRAPHIC");
- maRoleMap.put (new Integer(108), "EMBEDDED_OBJECT");
- maRoleMap.put (new Integer(109), "ENDNOTE");
- maRoleMap.put (new Integer(110), "FOOTNOTE");
- maRoleMap.put (new Integer(111), "SHAPE");
- }
- public static String GetRoleName (int nRole)
- {
- return (String)maRoleMap.get (new Integer(nRole));
- }
-
-
public NodeHandler createHandler (XAccessibleContext xContext)
{
if (xContext != null)
@@ -158,7 +47,7 @@ class AccessibleContextHandler
break;
case 1:
int nRole = xContext.getAccessibleRole();
- sChild = "Role: " + nRole + " (" + GetRoleName (nRole) + ")";
+ sChild = "Role: " + nRole + " (" + NameProvider.getRoleName(nRole) + ")";
break;
case 2:
XAccessible xParent = xContext.getAccessibleParent();
@@ -182,7 +71,7 @@ class AccessibleContextHandler
{
if (sChild.compareTo ("") != 0)
sChild += ", ";
- sChild += maStateNames[i];
+ sChild += NameProvider.getStateName(i);
}
}
}
diff --git a/toolkit/test/accessibility/AccessibleRelationHandler.java b/toolkit/test/accessibility/AccessibleRelationHandler.java
index 8de2e616c41d..ca6bdea6caab 100644
--- a/toolkit/test/accessibility/AccessibleRelationHandler.java
+++ b/toolkit/test/accessibility/AccessibleRelationHandler.java
@@ -13,9 +13,14 @@ class AccessibleRelationHandler
{
public NodeHandler createHandler( XAccessibleContext xContext )
{
- XAccessibleRelationSet xRelation = xContext.getAccessibleRelationSet();
- return (xRelation == null) ? null :
- new AccessibleRelationHandler(xContext);
+ AccessibleRelationHandler aHandler = null;
+ if (xContext != null)
+ {
+ XAccessibleRelationSet xRelation = xContext.getAccessibleRelationSet();
+ if (xRelation != null)
+ aHandler = new AccessibleRelationHandler(xContext);
+ }
+ return aHandler;
}
public AccessibleRelationHandler()
diff --git a/toolkit/test/accessibility/AccessibleTreeHandler.java b/toolkit/test/accessibility/AccessibleTreeHandler.java
index 34ca9fea8284..9da1b8232cec 100644
--- a/toolkit/test/accessibility/AccessibleTreeHandler.java
+++ b/toolkit/test/accessibility/AccessibleTreeHandler.java
@@ -52,7 +52,7 @@ class AccessibleTreeHandler
try
{
XAccessible xChild = mxContext.getAccessibleChild (nIndex);
- aChild = AccessibilityTreeModel.createDefaultNode (
+ aChild = NodeFactory.Instance().createDefaultNode (
xChild, aParent);
}
catch( IndexOutOfBoundsException e )
@@ -78,7 +78,7 @@ class AccessibleTreeHandler
int nIndex = xContext.getAccessibleIndexInParent() + 1;
if ((nIndex >= 0) || (nIndex <= maChildList.size()))
{
- aChild = AccessibilityTreeModel.createDefaultNode (xChild, aParent);
+ aChild = NodeFactory.Instance().createDefaultNode (xChild, aParent);
maChildList.insertElementAt (aChild, nIndex);
}
return aChild;
diff --git a/toolkit/test/accessibility/AccessibleTreeNode.java b/toolkit/test/accessibility/AccessibleTreeNode.java
index 162520d1da28..f9b0799e4423 100644
--- a/toolkit/test/accessibility/AccessibleTreeNode.java
+++ b/toolkit/test/accessibility/AccessibleTreeNode.java
@@ -44,6 +44,12 @@ class AccessibleTreeNode
throw new IndexOutOfBoundsException();
}
+ public AccessibleTreeNode getChildNoCreate (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ throw new IndexOutOfBoundsException();
+ }
+
public boolean removeChild (int nIndex)
throws IndexOutOfBoundsException
{
diff --git a/toolkit/test/accessibility/Canvas.java b/toolkit/test/accessibility/Canvas.java
index 770cb9b90adc..22986d471f7a 100755
--- a/toolkit/test/accessibility/Canvas.java
+++ b/toolkit/test/accessibility/Canvas.java
@@ -20,15 +20,15 @@ import drafts.com.sun.star.accessibility.XAccessibleComponent;
*/
class Canvas
extends JPanel
- implements MouseListener, MouseMotionListener, TreeSelectionListener
+ implements MouseListener, MouseMotionListener, TreeSelectionListener, Scrollable
{
public MessageInterface maMessageDisplay;
- public final int nMaximumWidth = 1000;
- public final int nMaximumHeight = 1000;
+ public final int nMaximumWidth = 800;
+ public final int nMaximumHeight = 800;
public static boolean bPaintText = false;
- public Canvas (MessageInterface aMessageDisplay)
+ public Canvas ()
{
super (true);
maObjects = new java.util.HashMap ();
@@ -38,13 +38,12 @@ class Canvas
addMouseListener (this);
addMouseMotionListener (this);
maBoundingBox = new Rectangle (0,0,100,100);
- setPreferredSize (maBoundingBox.getSize());
- setSize (nMaximumWidth,nMaximumHeight);
- maMessageDisplay = aMessageDisplay;
+ // setPreferredSize (new Dimension (nMaximumWidth,nMaximumHeight));
+ // setSize (nMaximumWidth,nMaximumHeight);
maTree = null;
- mnXOffset = 0;
- mnYOffset = 0;
- mnScaleFactor = 1;
+ mnHOffset = 0;
+ mnVOffset = 0;
+ mnScale = 1;
}
public void setTree (JTree aTree)
@@ -96,6 +95,7 @@ class Canvas
public void updateNode (AccTreeNode aNode)
{
int i = maNodes.indexOf (aNode);
+ System.out.println ("updating node " + i);
if (i != -1)
((AccessibleObject)maObjects.get(aNode)).update();
}
@@ -145,6 +145,8 @@ class Canvas
public void paintComponent (Graphics g)
{
+ super.paintComponent (g);
+
Graphics2D g2 = (Graphics2D)g;
if (mbAntialiasing)
g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
@@ -153,57 +155,93 @@ class Canvas
g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- Rectangle r = g.getClipBounds();
- g.clearRect (r.x,r.y,r.width,r.height);
-
- // Recalculate scale and offset so that all accessible objects fit
- // into the area specified by nMaximum(Width,Height)
- double nXScale = 1,
- nYScale = 1;
- int nWidth = (int)maBoundingBox.getWidth() + 50,
- nHeight = (int)maBoundingBox.getWidth() + 50;
- mnXOffset = (int)-maBoundingBox.getX() + 25;
- mnYOffset = (int)-maBoundingBox.getY() + 25;
- if (nWidth > nMaximumWidth)
- nXScale = 1.0 * nMaximumWidth / nWidth;
- if (nHeight > nMaximumHeight)
- nYScale = 1.0 * nMaximumHeight / nHeight;
- if (nXScale < nYScale)
- mnScaleFactor = nXScale;
- else
- mnScaleFactor = nYScale;
-
- // synchronized (maObjectList)
- // {
+ setupTransformation ();
+
+ // Draw the screen representation to give a hint of the location of the
+ // accessible object on the screen.
+ Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ // Fill the screen rectangle.
+ g.setColor (new Color (250,240,230));
+ g.fillRect (
+ (int)(mnHOffset+0.5),
+ (int)(mnVOffset+0.5),
+ (int)(mnScale*aScreenSize.getWidth()),
+ (int)(mnScale*aScreenSize.getHeight()));
+ // Draw a frame arround the screen rectangle to increase its visibility.
+ g.setColor (Color.BLACK);
+ g.drawRect (
+ (int)(mnHOffset+0.5),
+ (int)(mnVOffset+0.5),
+ (int)(mnScale*aScreenSize.getWidth()),
+ (int)(mnScale*aScreenSize.getHeight()));
+
+ synchronized (maObjectList)
+ {
int nCount = maObjectList.size();
for (int i=0; i<nCount; i++)
{
AccessibleObject aAccessibleObject = (AccessibleObject)maObjectList.elementAt(i);
aAccessibleObject.paint (
- g,
- mnXOffset, mnYOffset, mnScaleFactor,
+ g2,
+ mnHOffset, mnVOffset, mnScale,
mbShowDescriptions, mbShowNames);
}
- // }
+ }
// Paint highlighted frame around active object as the last thing.
if (maActiveObject != null)
maActiveObject.paint_highlight (
g,
- mnXOffset, mnYOffset, mnScaleFactor);
+ mnHOffset, mnVOffset, mnScale);
}
+ /** Set up the transformation so that the graphical display can show a
+ centered representation of the whole screen.
+ */
+ private void setupTransformation ()
+ {
+ Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension aWidgetSize = getSize();
+ if ((aScreenSize.getWidth() > 0) && (aScreenSize.getHeight() > 0))
+ {
+ // Calculate the scales that would map the screen onto the
+ // widget in both of the coordinate axes and select the smaller
+ // of the two: it maps the screen onto the widget in both axes
+ // at the same time.
+ double nHScale = (aWidgetSize.getWidth() - 10) / aScreenSize.getWidth();
+ double nVScale = (aWidgetSize.getHeight() - 10) / aScreenSize.getHeight();
+ if (nHScale < nVScale)
+ mnScale = nHScale;
+ else
+ mnScale = nVScale;
+
+ // Calculate offsets that center the scaled screen inside the widget.
+ mnHOffset = (aWidgetSize.getWidth() - mnScale*aScreenSize.getWidth()) / 2.0;
+ mnVOffset = (aWidgetSize.getHeight() - mnScale*aScreenSize.getHeight()) / 2.0;
+ }
+ else
+ {
+ // In case of a degenerate (not yet initialized?) screen size
+ // use some meaningless default values.
+ mnScale = 1;
+ mnHOffset = 0;
+ mnVOffset = 0;
+ }
+ }
+
+
+
/** Call getAccessibleAt to determine accessible object under mouse.
*/
public void mouseClicked (MouseEvent e)
{
- FindAccessibleObjectUnderMouse (e);
+ /* FindAccessibleObjectUnderMouse (e);
// Because we have no access (at the moment) to the root node of the
// accessibility tree we use the first accessible object inserted
// into the canvas instead.
com.sun.star.awt.Point aPosition = new com.sun.star.awt.Point (
- (int)((e.getX() + mnXOffset) / mnScaleFactor),
- (int)((e.getY() + mnYOffset) / mnScaleFactor));
+ (int)((e.getX() + mnHOffset) / mnScale),
+ (int)((e.getY() + mnVOffset) / mnScale));
if (maObjects.size() > 0 && maActiveObject != null)
{
// Get component interface of object which is to be queried
@@ -225,11 +263,17 @@ class Canvas
}
maMessageDisplay.message ("no object found at"
+ aPosition.X + "," + aPosition.Y);
+ */
}
public void mousePressed (MouseEvent e)
{
- FindAccessibleObjectUnderMouse (e);
+ AccessibleObject aObjectUnderMouse = FindAccessibleObjectUnderMouse (e);
+ highlightObject (aObjectUnderMouse);
+ if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0)
+ {
+ maTree.expandPath (aObjectUnderMouse.getPath());
+ }
}
public void mouseReleased (MouseEvent e)
@@ -258,13 +302,13 @@ class Canvas
public void mouseMoved (MouseEvent e)
{
if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0)
- FindAccessibleObjectUnderMouse (e);
+ highlightObject (FindAccessibleObjectUnderMouse (e));
}
- protected void FindAccessibleObjectUnderMouse (MouseEvent e)
+ protected AccessibleObject FindAccessibleObjectUnderMouse (MouseEvent e)
{
int nObjects = maObjects.size();
- AccessibleObject aNewActiveObject = null;
+ AccessibleObject aObjectUnderMouse = null;
int nCount = maObjectList.size();
for (int i=nCount-1; i>=0; --i)
{
@@ -272,21 +316,11 @@ class Canvas
if (aObject != null)
if (aObject.contains (e.getX(),e.getY()))
{
- aNewActiveObject = aObject;
+ aObjectUnderMouse = aObject;
break;
}
}
- if (highlightObject (aNewActiveObject))
- {
- if (maActiveObject != null && maTree != null)
- {
- maTree.scrollPathToVisible (maActiveObject.getPath());
- maTree.setSelectionPath (maActiveObject.getPath());
- maTree.repaint ();
- }
-
- repaint ();
- }
+ return aObjectUnderMouse;
}
protected boolean highlightObject (AccessibleObject aNewActiveObject)
@@ -299,7 +333,14 @@ class Canvas
maActiveObject = aNewActiveObject;
if (maActiveObject != null)
{
+ if (maTree != null)
+ {
+ maTree.scrollPathToVisible (maActiveObject.getPath());
+ maTree.setSelectionPath (maActiveObject.getPath());
+ maTree.repaint ();
+ }
maActiveObject.highlight ();
+ repaint ();
}
return true;
}
@@ -322,14 +363,40 @@ class Canvas
}
}
+
+ public Dimension getPreferredScrollableViewportSize ()
+ {
+ return new Dimension (nMaximumWidth,nMaximumHeight);
+ }
+
+ public int getScrollableBlockIncrement (Rectangle visibleRect, int orientation, int direction)
+ {
+ return 25;
+ }
+
+ public boolean getScrollableTracksViewportHeight ()
+ {
+ return false;
+ }
+
+ public boolean getScrollableTracksViewportWidth ()
+ {
+ return false;
+ }
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
+ {
+ return 1;
+ }
+
protected int
mnXAnchor,
mnYAnchor,
- maResizeFlag,
- mnXOffset,
- mnYOffset;
- protected double
- mnScaleFactor;
+ maResizeFlag;
+ private double
+ mnHOffset,
+ mnVOffset,
+ mnScale;
protected AccessibleObject
maActiveObject;
protected java.util.HashMap
diff --git a/toolkit/test/accessibility/ChildEventHandler.java b/toolkit/test/accessibility/ChildEventHandler.java
new file mode 100644
index 000000000000..546a75f95fca
--- /dev/null
+++ b/toolkit/test/accessibility/ChildEventHandler.java
@@ -0,0 +1,46 @@
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+class ChildEventHandler
+ extends EventHandler
+{
+ public ChildEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ mxOldChild = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.OldValue);
+ mxNewChild = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.NewValue);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ if (mxOldChild != null)
+ out.println (" removing child " + mxOldChild);
+ if (mxNewChild != null)
+ out.println (" adding child " + mxNewChild);
+ }
+
+ public void Process ()
+ {
+ // Insertion and removal of children should be mutually exclusive.
+ // But this is a test tool and should take everything into account.
+ if (mxOldChild != null)
+ {
+ maTreeModel.removeNode (mxOldChild.getAccessibleContext());
+ maTreeModel.updateNode (mxEventSource, AccessibleTreeHandler.class);
+ }
+
+ if (mxNewChild != null)
+ {
+ maTreeModel.addChild (mxEventSource, mxNewChild);
+ }
+ }
+
+
+ private XAccessible mxOldChild;
+ private XAccessible mxNewChild;
+}
diff --git a/toolkit/test/accessibility/ContextEventHandler.java b/toolkit/test/accessibility/ContextEventHandler.java
new file mode 100644
index 000000000000..f07f86d5f967
--- /dev/null
+++ b/toolkit/test/accessibility/ContextEventHandler.java
@@ -0,0 +1,50 @@
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.AccessibleEventObject;
+import drafts.com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+
+import java.io.PrintStream;
+
+class ContextEventHandler
+ extends EventHandler
+{
+ public ContextEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ switch (mnEventId)
+ {
+ case AccessibleEventId.ACCESSIBLE_STATE_EVENT:
+ try
+ {
+ int nOldValue = AnyConverter.toInt (maEvent.OldValue);
+ out.println (" turning off state " + nOldValue + " ("
+ + NameProvider.getStateName (nOldValue) + ")");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {}
+ try
+ {
+ int nNewValue = AnyConverter.toInt (maEvent.NewValue);
+ out.println (" turning on state " + nNewValue + " ("
+ + NameProvider.getStateName (nNewValue) + ")");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {}
+ break;
+
+ default:
+ super.PrintOldAndNew (out);
+ }
+
+ }
+
+ public void Process ()
+ {
+ maTreeModel.updateNode (mxEventSource, AccessibleContextHandler.class);
+ }
+}
diff --git a/toolkit/test/accessibility/EventHandler.java b/toolkit/test/accessibility/EventHandler.java
new file mode 100644
index 000000000000..2c9cdc7a352d
--- /dev/null
+++ b/toolkit/test/accessibility/EventHandler.java
@@ -0,0 +1,56 @@
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.XAccessibleContext;
+import drafts.com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+
+/** Base class for handling of accessibility events.
+*/
+class EventHandler
+{
+ public EventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ maEvent = aEvent;
+ maTreeModel = aTreeModel;
+
+ mnEventId = aEvent.EventId;
+
+ mxEventSource = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, aEvent.Source);
+ if (mxEventSource == null)
+ {
+ XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.Source);
+ if (xAccessible != null)
+ mxEventSource = xAccessible.getAccessibleContext();
+ }
+ }
+
+ public void Print (PrintStream out)
+ {
+ out.println ("Event id is " + mnEventId
+ + " (" + NameProvider.getEventName(mnEventId)+")"
+ + " for " + mxEventSource.getAccessibleName() + " / "
+ + NameProvider.getRoleName (mxEventSource.getAccessibleRole()));
+ PrintOldAndNew (out);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ out.println (" old value is " + maEvent.OldValue);
+ out.println (" new value is " + maEvent.NewValue);
+ }
+
+ public void Process ()
+ {
+ System.out.println ("processing of event " + maEvent + " not implemented");
+ }
+
+ protected AccessibleEventObject maEvent;
+ protected AccessibilityTreeModel maTreeModel;
+
+ protected int mnEventId;
+ protected XAccessibleContext mxEventSource;
+}
diff --git a/toolkit/test/accessibility/EventListener.java b/toolkit/test/accessibility/EventListener.java
new file mode 100644
index 000000000000..5d8a781d9eff
--- /dev/null
+++ b/toolkit/test/accessibility/EventListener.java
@@ -0,0 +1,125 @@
+
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeModelEvent;
+
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.Enumeration;
+
+import drafts.com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.Any;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+
+/** Objects of this class (usually one, singleton?) listen to accessible
+ events of all objects in all trees.
+*/
+public class EventListener
+{
+ public EventListener (AccessibilityTreeModel aTreeModel)
+ {
+ maTreeModel = aTreeModel;
+ }
+
+
+ private static String objectToString(Object aObject)
+ {
+ if (aObject == null)
+ return null;
+ else
+ return aObject.toString();
+ }
+
+
+
+ /** This method handles accessibility objects that are being disposed.
+ */
+ public void disposing (XAccessibleContext xContext)
+ {
+ System.out.println("dispose: " + objectToString(xContext));
+ maTreeModel.removeNode (xContext);
+ }
+
+ /** This method is called from accessible objects that broadcast
+ modifications of themselves or from their children. The event is
+ processed only, except printing some messages, if the tree is not
+ locked. It should be locked during changes to its internal
+ structure like expanding nodes.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ EventHandler aHandler;
+
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.ACCESSIBLE_CHILD_EVENT:
+ aHandler = new ChildEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACCESSIBLE_BOUNDRECT_EVENT:
+ case AccessibleEventId.ACCESSIBLE_VISIBLE_DATA_EVENT:
+ aHandler = new GeometryEventHandler (aEvent, maTreeModel);
+ break;
+
+
+ case AccessibleEventId.ACCESSIBLE_NAME_EVENT:
+ case AccessibleEventId.ACCESSIBLE_DESCRIPTION_EVENT:
+ case AccessibleEventId.ACCESSIBLE_STATE_EVENT:
+ case AccessibleEventId.CONTROLLED_BY_EVENT:
+ case AccessibleEventId.CONTROLLER_FOR_EVENT:
+ case AccessibleEventId.LABEL_FOR_EVENT:
+ case AccessibleEventId.LABELED_BY_EVENT:
+ case AccessibleEventId.MEMBER_OF_EVENT:
+ case AccessibleEventId.ACCESSIBLE_SELECTION_EVENT:
+ aHandler = new ContextEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACCESSIBLE_TABLE_MODEL_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_CAPTION_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_COLUMN_HEADER_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_ROW_DESCRIPTION_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_ROW_HEADER_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TABLE_SUMMARY_EVENT:
+ aHandler = new TableEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACCESSIBLE_ACTION_EVENT:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACCESSIBLE_HYPERTEXT_EVENT:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACCESSIBLE_ACTIVE_DESCENDANT_EVENT:
+ case AccessibleEventId.ACCESSIBLE_CARET_EVENT:
+ case AccessibleEventId.ACCESSIBLE_TEXT_EVENT:
+ case AccessibleEventId.ACCESSIBLE_VALUE_EVENT:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ default:
+ aHandler = null;
+ break;
+ }
+
+ if (aHandler == null)
+ System.out.println (" unhandled event");
+ else
+ {
+ aHandler.Print (System.out);
+ aHandler.Process ();
+ }
+ }
+
+
+ private AccessibilityTreeModel maTreeModel;
+}
diff --git a/toolkit/test/accessibility/EventLogger.java b/toolkit/test/accessibility/EventLogger.java
new file mode 100644
index 000000000000..b3509c21cc48
--- /dev/null
+++ b/toolkit/test/accessibility/EventLogger.java
@@ -0,0 +1,25 @@
+import javax.swing.JFrame;
+
+class EventLogger
+{
+ public static synchronized EventLogger Instance ()
+ {
+ if (maInstance == null)
+ maInstance = new EventLogger();
+ return maInstance;
+ }
+
+ private EventLogger ()
+ {
+ maFrame = new JFrame ();
+ maLogger = new TextLogger ();
+ maFrame.getContentPane().add (maLogger);
+
+ maFrame.pack ();
+ maFrame.setVisible (true);
+ }
+
+ private static EventLogger maInstance = null;
+ private JFrame maFrame;
+ private TextLogger maLogger;
+}
diff --git a/toolkit/test/accessibility/EventQueue.java b/toolkit/test/accessibility/EventQueue.java
new file mode 100644
index 000000000000..0ddbe9350ceb
--- /dev/null
+++ b/toolkit/test/accessibility/EventQueue.java
@@ -0,0 +1,119 @@
+import drafts.com.sun.star.accessibility.*;
+import com.sun.star.lang.EventObject;
+
+import java.util.LinkedList;
+
+/** The event queue singleton dispatches events received from OpenOffice.org
+ applications in a thread separate from the AWB main thread.
+
+ The queue of event objects, LinkedList<Runnable> The queue object will
+ also serve as lock for the consumer/producer type syncronization.
+*/
+class EventQueue
+ implements Runnable
+{
+ public synchronized static EventQueue Instance ()
+ {
+ if (maInstance == null)
+ maInstance = new EventQueue ();
+ return maInstance;
+ }
+
+ public void addEvent (Runnable aEvent)
+ {
+ synchronized (maMonitor)
+ {
+ System.out.println ("adding regular event " + aEvent);
+ maRegularQueue.addLast (aEvent);
+ maMonitor.notify ();
+ }
+ }
+
+
+ public void addDisposingEvent (Runnable aEvent)
+ {
+ aEvent.run ();
+ /*
+ synchronized (maMonitor)
+ {
+ System.out.println ("adding disposing event " + aEvent);
+ maDisposingQueue.addLast (aEvent);
+ maMonitor.notify ();
+ }
+ */
+ }
+
+
+ private EventQueue ()
+ {
+ maMonitor = new Boolean (true);
+ maRegularQueue = new LinkedList();
+ maDisposingQueue = new LinkedList();
+ new Thread(this, "AWB.EventQueue").start();
+ }
+
+
+ /// This thread's main method: deliver all events
+ public void run()
+ {
+ // in an infinite loop, check for events to deliver, then
+ // wait on lock (which will be notified when new events arrive)
+ while( true )
+ {
+ Runnable aEvent = null;
+ do
+ {
+ synchronized (maMonitor)
+ {
+ if (maDisposingQueue.size() > 0)
+ {
+ aEvent = (Runnable)maDisposingQueue.removeFirst();
+ System.out.println ("delivering disposing event " + aEvent);
+ }
+ else if (maRegularQueue.size() > 0)
+ {
+ aEvent = (Runnable)maRegularQueue.removeFirst();
+ System.out.println ("delivering regular event " + aEvent);
+ }
+ else
+ aEvent = null;
+ }
+ if (aEvent != null)
+ {
+ try
+ {
+ aEvent.run();
+ }
+ catch( Throwable e )
+ {
+ System.out.println(
+ "Exception during event delivery: " + e );
+ e.printStackTrace();
+ }
+ }
+ }
+ while( aEvent != null );
+
+ try
+ {
+ synchronized (maMonitor)
+ {
+ maMonitor.wait();
+ }
+ }
+ catch (Exception e)
+ {
+ // can't wait? odd!
+ System.err.println("Can't wait!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static EventQueue maInstance = null;
+ private Object maMonitor;
+ private LinkedList maRegularQueue;
+ private LinkedList maDisposingQueue;
+}
+
+
diff --git a/toolkit/test/accessibility/GeometryEventHandler.java b/toolkit/test/accessibility/GeometryEventHandler.java
new file mode 100644
index 000000000000..cc3cace9238d
--- /dev/null
+++ b/toolkit/test/accessibility/GeometryEventHandler.java
@@ -0,0 +1,26 @@
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+class GeometryEventHandler
+ extends EventHandler
+{
+ public GeometryEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ out.println (" children not relevant");
+ }
+
+ public void Process ()
+ {
+ maTreeModel.updateNode (mxEventSource,
+ AccessibleComponentHandler.class,
+ AccessibleExtendedComponentHandler.class);
+ }
+}
diff --git a/toolkit/test/accessibility/InformationWriter.java b/toolkit/test/accessibility/InformationWriter.java
index b1ea3fd67f84..444655db2eb9 100755
--- a/toolkit/test/accessibility/InformationWriter.java
+++ b/toolkit/test/accessibility/InformationWriter.java
@@ -43,21 +43,11 @@ import drafts.com.sun.star.accessibility.XAccessibleRelationSet;
import drafts.com.sun.star.accessibility.XAccessibleStateSet;
public class InformationWriter
- implements Print
{
- Print maPrinter;
-
public InformationWriter ()
{
- this(null);
- }
-
- public InformationWriter (Print aPrinter)
- {
- maPrinter = aPrinter;
}
-
public void drawPageTest (XInterface xPage)
{
try
@@ -82,12 +72,12 @@ public class InformationWriter
{
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xObject);
- println (prefix +
+ MessageArea.println (prefix +
xPropertySet.getPropertyValue (name));
}
catch (Exception e)
{
- println ("caught exception while getting property "
+ MessageArea.println ("caught exception while getting property "
+ name + " : " + e);
}
}
@@ -101,7 +91,7 @@ public class InformationWriter
XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface(
XIndexAccess.class, xPage);
- println ("There are " + xShapeList.getCount()
+ MessageArea.println ("There are " + xShapeList.getCount()
+ " shapes");
for (int i=0; i<xShapeList.getCount(); i++)
{
@@ -112,19 +102,19 @@ public class InformationWriter
(XShapeDescriptor) UnoRuntime.queryInterface(
XShapeDescriptor.class, xShape);
String sName = xShapeDescriptor.getShapeType ();
- println (" shape " + i + " : " + sName);
+ MessageArea.println (" shape " + i + " : " + sName);
XPropertySet xPropertySet =
(XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xShape);
Integer nZOrder =
(Integer) xPropertySet.getPropertyValue ("ZOrder");
- println (" zorder = " + nZOrder);
+ MessageArea.println (" zorder = " + nZOrder);
}
}
catch (Exception e)
{
- println ("caught exception in showShapes: " + e);
+ MessageArea.println ("caught exception in showShapes: " + e);
}
}
@@ -138,25 +128,25 @@ public class InformationWriter
{
try
{
- println ("Services:");
+ MessageArea.println ("Services:");
XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface (
XMultiServiceFactory.class,
xObject
);
if (xMSF == null)
- println (" object does not support interface XMultiServiceFactory");
+ MessageArea.println (" object does not support interface XMultiServiceFactory");
else
{
String[] sServiceNames = xMSF.getAvailableServiceNames ();
- println (" object can create "
+ MessageArea.println (" object can create "
+ sServiceNames.length + " services");
for (int i=0; i<sServiceNames.length; i++)
- println (" service " + i + " : " + sServiceNames[i]);
+ MessageArea.println (" service " + i + " : " + sServiceNames[i]);
}
}
catch (Exception e)
{
- println ("caught exception in showServices : " + e);
+ MessageArea.println ("caught exception in showServices : " + e);
}
}
@@ -172,10 +162,10 @@ public class InformationWriter
XServiceName xSN = (XServiceName) UnoRuntime.queryInterface (
XServiceName.class, xObject);
if (xSN == null)
- println (" interface XServiceName not supported");
+ MessageArea.println (" interface XServiceName not supported");
else
{
- println (" Service name : " + xSN.getServiceName ());
+ MessageArea.println (" Service name : " + xSN.getServiceName ());
}
// Use interface XServiceInfo to retrieve information about
@@ -183,16 +173,16 @@ public class InformationWriter
XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface (
XServiceInfo.class, xObject);
if (xSI == null)
- println (" interface XServiceInfo not supported");
+ MessageArea.println (" interface XServiceInfo not supported");
else
{
- println (" Implementation name : "
+ MessageArea.println (" Implementation name : "
+ xSI.getImplementationName ());
}
}
catch (Exception e)
{
- println ("caught exception in showInfo : " + e);
+ MessageArea.println ("caught exception in showInfo : " + e);
}
}
@@ -205,26 +195,26 @@ public class InformationWriter
{
try
{
- println ("Interfaces:");
+ MessageArea.println ("Interfaces:");
// Use interface XTypeProvider to retrieve a list of supported
// interfaces.
XTypeProvider xTP = (XTypeProvider) UnoRuntime.queryInterface (
XTypeProvider.class, xObject);
if (xTP == null)
- println (" interface XTypeProvider not supported");
+ MessageArea.println (" interface XTypeProvider not supported");
else
{
Type[] aTypeList = xTP.getTypes ();
- println (" object supports " + aTypeList.length
+ MessageArea.println (" object supports " + aTypeList.length
+ " interfaces");
for (int i=0; i<aTypeList.length; i++)
- println (" " + i + " : "
+ MessageArea.println (" " + i + " : "
+ aTypeList[i].getTypeName());
}
}
catch (Exception e)
{
- println ("caught exception in showInterfaces : " + e);
+ MessageArea.println ("caught exception in showInterfaces : " + e);
}
}
@@ -253,7 +243,7 @@ public class InformationWriter
XAccessible.class, xObject);
if (xAccessible == null)
{
- println (sIndent + "given object " + xObject
+ MessageArea.println (sIndent + "given object " + xObject
+ " is not accessible");
return false;
}
@@ -264,41 +254,41 @@ public class InformationWriter
// Print information about the accessible context.
if (xContext != null)
{
- println (sIndent + "Name : "
+ MessageArea.println (sIndent + "Name : "
+ xContext.getAccessibleName());
- println (sIndent + "Description : "
+ MessageArea.println (sIndent + "Description : "
+ xContext.getAccessibleDescription());
- println (sIndent + "Role : "
+ MessageArea.println (sIndent + "Role : "
+ xContext.getAccessibleRole());
String sHasParent;
if (xContext.getAccessibleParent() != null)
{
- println (sIndent + "Has parent : yes");
- println (sIndent + "Parent index : "
+ MessageArea.println (sIndent + "Has parent : yes");
+ MessageArea.println (sIndent + "Parent index : "
+ xContext.getAccessibleIndexInParent());
}
else
- println (sIndent + "Has parent : no");
- println (sIndent + "Child count : "
+ MessageArea.println (sIndent + "Has parent : no");
+ MessageArea.println (sIndent + "Child count : "
+ xContext.getAccessibleChildCount());
- print (sIndent + "Relation set : ");
+ MessageArea.print (sIndent + "Relation set : ");
XAccessibleRelationSet xRelationSet
= xContext.getAccessibleRelationSet();
if (xRelationSet != null)
{
- print (xRelationSet.getRelationCount() + " (");
+ MessageArea.print (xRelationSet.getRelationCount() + " (");
for (int i=0; i<xRelationSet.getRelationCount(); i++)
{
if (i > 0)
- print (", ");
- print (xRelationSet.getRelation(i).toString());
+ MessageArea.print (", ");
+ MessageArea.print (xRelationSet.getRelation(i).toString());
}
- println (")");
+ MessageArea.println (")");
}
else
- println ("no relation set");
+ MessageArea.println ("no relation set");
- print (sIndent + "State set : ");
+ MessageArea.print (sIndent + "State set : ");
XAccessibleStateSet xStateSet =
xContext.getAccessibleStateSet();
if (xStateSet != null)
@@ -306,22 +296,22 @@ public class InformationWriter
XIndexAccess xStates =
(XIndexAccess) UnoRuntime.queryInterface (
XIndexAccess.class, xStateSet);
- print (xStates.getCount() + " (");
+ MessageArea.print (xStates.getCount() + " (");
for (int i=0; i<xStates.getCount(); i++)
{
if (i > 0)
- print (", ");
- print (xStates.getByIndex(i).toString());
+ MessageArea.print (", ");
+ MessageArea.print (xStates.getByIndex(i).toString());
}
- println (")");
+ MessageArea.println (")");
}
else
- println ("no state set");
+ MessageArea.println ("no state set");
showAccessibleComponent (xContext, sIndent);
}
else
- println ("object has no accessible context.");
+ MessageArea.println ("object has no accessible context.");
// showInfo (xContext);
// showServices (xContext);
@@ -350,13 +340,13 @@ public class InformationWriter
// Print information about the accessible context.
if (xComponent != null)
{
- println (sIndent + "Position : "
+ MessageArea.println (sIndent + "Position : "
+ xComponent.getLocation().X+", "
+ xComponent.getLocation().Y);
- println (sIndent + "Screen position : "
+ MessageArea.println (sIndent + "Screen position : "
+ xComponent.getLocationOnScreen().X+", "
+ xComponent.getLocationOnScreen().Y);
- println (sIndent + "Size : "
+ MessageArea.println (sIndent + "Size : "
+ xComponent.getSize().Width+", "
+ xComponent.getSize().Height);
}
@@ -390,12 +380,12 @@ public class InformationWriter
int n = xContext.getAccessibleChildCount();
for (int i=0; i<n; i++)
{
- println (sIndent + "child " + i + " :");
+ MessageArea.println (sIndent + "child " + i + " :");
showAccessibilityTree (xContext.getAccessibleChild(i),depth+1);
}
}
else
- println ("Accessible object has no context");
+ MessageArea.println ("Accessible object has no context");
}
catch (Exception e)
{
@@ -412,30 +402,14 @@ public class InformationWriter
XPropertySet xSet = (XPropertySet) UnoRuntime.queryInterface (
XPropertySet.class, xObject);
if (xSet == null)
- println ("object does not support XPropertySet");
+ MessageArea.println ("object does not support XPropertySet");
else
{
XPropertySetInfo xInfo = xSet.getPropertySetInfo ();
Property[] aProperties = xInfo.getProperties ();
int n = aProperties.length;
for (int i=0; i<n; i++)
- println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type);
+ MessageArea.println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type);
}
}
-
- public void print (String text)
- {
- if (maPrinter == null)
- System.out.print (text);
- else
- maPrinter.print (text);
- }
-
- public void println (String text)
- {
- if (maPrinter == null)
- System.out.println (text);
- else
- maPrinter.println (text);
- }
}
diff --git a/toolkit/test/accessibility/MessageArea.java b/toolkit/test/accessibility/MessageArea.java
new file mode 100644
index 000000000000..17bf28a2e23c
--- /dev/null
+++ b/toolkit/test/accessibility/MessageArea.java
@@ -0,0 +1,120 @@
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.Color;
+import java.awt.Graphics;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JScrollBar;
+
+
+
+/** A message area displays text in a scrollable text widget. It is a
+ singleton. Other objects can access it directly to display messages.
+*/
+public class MessageArea
+ extends JScrollPane
+{
+ public static synchronized MessageArea Instance ()
+ {
+ if (saInstance == null)
+ saInstance = new MessageArea ();
+ return saInstance;
+ }
+
+
+
+
+ /** Create a new message area. This method is private because the class is
+ a singleton and may therefore not be instanciated from the outside.
+ */
+ private MessageArea ()
+ {
+ maText = new JTextArea();
+ maText.setBackground (new Color (255,250,240));
+ maText.setFont (new Font ("Helvetica", Font.PLAIN, 9));
+ setViewportView (maText);
+ setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+
+ printMessage (
+ "class path is " + System.getProperty ("java.class.path") + "\n");
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static synchronized void print (String aMessage)
+ {
+ print (0, aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible. Indent the string as requested.
+ */
+ public static synchronized void print (int nIndentation, String aMessage)
+ {
+ while (nIndentation-- > 0)
+ aMessage = " " + aMessage;
+ Instance().printMessage(aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static void println (String aMessage)
+ {
+ println (0, aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static void println (int nIndentation, String aMessage)
+ {
+ print (nIndentation, aMessage+"\n");
+ }
+
+
+
+
+ public void paintComponent (Graphics g)
+ {
+ JScrollBar sb = getVerticalScrollBar();
+ if (sb != null)
+ {
+ int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1;
+ sb.setValue (nScrollBarValue);
+ }
+ super.paintComponent (g);
+ }
+
+
+
+
+ /** Append the given string to the end of the text and scroll so that it
+ becomes visible. This is an internal method. Use one of the static
+ and public ones.
+ */
+ private synchronized void printMessage (String aMessage)
+ {
+ maText.append (aMessage);
+ }
+
+
+
+
+ private static MessageArea saInstance = null;
+ private JTextArea maText;
+}
diff --git a/toolkit/test/accessibility/NodeFactory.java b/toolkit/test/accessibility/NodeFactory.java
new file mode 100644
index 000000000000..3e0667da7282
--- /dev/null
+++ b/toolkit/test/accessibility/NodeFactory.java
@@ -0,0 +1,145 @@
+import drafts.com.sun.star.accessibility.*;
+import java.util.Vector;
+
+/** This singleton class creates nodes for given accessible objects.
+*/
+class NodeFactory
+{
+ public synchronized static NodeFactory Instance ()
+ {
+ if (maInstance == null)
+ {
+ maInstance = new NodeFactory();
+ }
+ return maInstance;
+ }
+
+ private NodeFactory ()
+ {
+ mbVerbose = false;
+
+ maContextHandler = new AccessibleContextHandler();
+ maTextHandler = new AccessibleTextHandler();
+ maEditableTextHandler = new AccessibleEditableTextHandler();
+ maComponentHandler = new AccessibleComponentHandler();
+ maExtendedComponentHandler = new AccessibleExtendedComponentHandler();
+ maActionHandler = new AccessibleActionHandler();
+ maImageHandler = new AccessibleImageHandler();
+ maTableHandler = new AccessibleTableHandler();
+ maCellHandler = new AccessibleCellHandler();
+ maHypertextHandler = new AccessibleHypertextHandler();
+ maHyperlinkHandler = new AccessibleHyperlinkHandler();
+ maSelectionHandler = new AccessibleSelectionHandler();
+ maRelationHandler = new AccessibleRelationHandler();
+ maTreeHandler = new AccessibleTreeHandler();
+ maUNOHandler = new AccessibleUNOHandler();
+ }
+
+
+ /** add default handlers based on the supported interfaces */
+ private void addDefaultHandlers (AccTreeNode aNode, XAccessibleContext xContext)
+ {
+ if (false)
+ {
+ // Slow but complete version: try each handler type separately.
+ aNode.addHandler (maContextHandler.createHandler (xContext));
+ aNode.addHandler (maTextHandler.createHandler (xContext));
+ aNode.addHandler (maEditableTextHandler.createHandler (xContext));
+ aNode.addHandler (maComponentHandler.createHandler (xContext));
+ aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
+ aNode.addHandler (maActionHandler.createHandler (xContext));
+ aNode.addHandler (maImageHandler.createHandler (xContext));
+ aNode.addHandler (maTableHandler.createHandler (xContext));
+ aNode.addHandler (maCellHandler.createHandler (xContext));
+ aNode.addHandler (maHypertextHandler.createHandler (xContext));
+ aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
+ aNode.addHandler (maSelectionHandler.createHandler (xContext));
+ aNode.addHandler (maRelationHandler.createHandler (xContext));
+ aNode.addHandler (maUNOHandler.createHandler (xContext));
+ aNode.addHandler (maTreeHandler.createHandler (xContext));
+ }
+ else
+ {
+ // Exploit dependencies between interfaces.
+ NodeHandler aHandler;
+ aNode.addHandler (maContextHandler.createHandler (xContext));
+
+ aHandler = maTextHandler.createHandler (xContext);
+ if (aHandler != null)
+ {
+ aNode.addHandler (aHandler);
+ aNode.addHandler (maEditableTextHandler.createHandler (xContext));
+ aNode.addHandler (maHypertextHandler.createHandler (xContext));
+ aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
+ }
+ aHandler = maComponentHandler.createHandler (xContext);
+ if (aHandler != null)
+ {
+ aNode.addHandler (aHandler);
+ aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
+ }
+ aNode.addHandler (maActionHandler.createHandler (xContext));
+ aNode.addHandler (maImageHandler.createHandler (xContext));
+ aNode.addHandler (maTableHandler.createHandler (xContext));
+ aNode.addHandler (maRelationHandler.createHandler (xContext));
+ aNode.addHandler (maCellHandler.createHandler (xContext));
+ aNode.addHandler (maSelectionHandler.createHandler (xContext));
+ aNode.addHandler (maUNOHandler.createHandler (xContext));
+ aNode.addHandler (maTreeHandler.createHandler (xContext));
+ }
+ }
+
+ /** create a node with the default handlers */
+ public AccTreeNode createDefaultNode (XAccessible xAccessible, AccessibleTreeNode aParent)
+ {
+ // default: aObject + aDisplay
+ String sDisplay;
+
+ // if we are accessible, we use the context + name instead
+ XAccessibleContext xContext = null;
+ if (xAccessible != null)
+ xContext = xAccessible.getAccessibleContext();
+ if (xContext != null)
+ {
+ sDisplay = xContext.getAccessibleName();
+ if (sDisplay.length()==0)
+ {
+ sDisplay = "<no name> Role: "
+ + NameProvider.getRoleName (
+ xContext.getAccessibleRole());
+ }
+ }
+ else
+ sDisplay = new String ("not accessible");
+
+
+ // create node, and add default handlers
+ AccTreeNode aNode = new AccTreeNode (xAccessible, xContext, sDisplay, aParent);
+ addDefaultHandlers (aNode, xContext);
+
+ if (aNode == null)
+ System.out.println ("createDefaultNode == null");
+ return aNode;
+ }
+
+ private static NodeFactory maInstance = null;
+
+ private boolean mbVerbose;
+
+ // default handlers
+ private NodeHandler maContextHandler = new AccessibleContextHandler();
+ private NodeHandler maTextHandler = new AccessibleTextHandler();
+ private NodeHandler maEditableTextHandler = new AccessibleEditableTextHandler();
+ private NodeHandler maComponentHandler = new AccessibleComponentHandler();
+ private NodeHandler maExtendedComponentHandler = new AccessibleExtendedComponentHandler();
+ private NodeHandler maActionHandler = new AccessibleActionHandler();
+ private NodeHandler maImageHandler = new AccessibleImageHandler();
+ private NodeHandler maTableHandler = new AccessibleTableHandler();
+ private NodeHandler maCellHandler = new AccessibleCellHandler();
+ private NodeHandler maHypertextHandler = new AccessibleHypertextHandler();
+ private NodeHandler maHyperlinkHandler = new AccessibleHyperlinkHandler();
+ private NodeHandler maSelectionHandler = new AccessibleSelectionHandler();
+ private NodeHandler maRelationHandler = new AccessibleRelationHandler();
+ private NodeHandler maTreeHandler = new AccessibleTreeHandler();
+ private NodeHandler maUNOHandler = new AccessibleUNOHandler();
+}
diff --git a/toolkit/test/accessibility/NodeHandler.java b/toolkit/test/accessibility/NodeHandler.java
index 802ed83baf96..0d79ffd5861f 100644
--- a/toolkit/test/accessibility/NodeHandler.java
+++ b/toolkit/test/accessibility/NodeHandler.java
@@ -55,6 +55,11 @@ abstract class NodeHandler
return aChild;
}
+ public AccessibleTreeNode getChildNoCreate (AccessibleTreeNode aParent, int nIndex)
+ {
+ return (AccessibleTreeNode)maChildList.get(nIndex);
+ }
+
/** Remove the specified child from the list of children.
*/
public boolean removeChild (AccessibleTreeNode aNode, int nIndex)
diff --git a/toolkit/test/accessibility/NodeMap.java b/toolkit/test/accessibility/NodeMap.java
new file mode 100644
index 000000000000..f32cfd5d4301
--- /dev/null
+++ b/toolkit/test/accessibility/NodeMap.java
@@ -0,0 +1,112 @@
+import drafts.com.sun.star.accessibility.XAccessibleContext;
+
+import java.util.HashMap;
+
+abstract class NodeMapCallback
+{
+ public abstract void Apply (AccTreeNode aNode);
+}
+
+/** This map translates from XAccessible objects to our internal
+ representations.
+*/
+class NodeMap
+{
+ public NodeMap ()
+ {
+ maXAccessibleToNode = new HashMap ();
+ }
+
+ /** Clear the whole map.
+ */
+ public void Clear ()
+ {
+ maXAccessibleToNode.clear();
+ }
+
+ /** @return
+ whether the new node was different from a previous one
+ repspectively was the first one set.
+ */
+ public boolean InsertNode (XAccessibleContext xContext, AccessibleTreeNode aNode)
+ {
+ AccessibleTreeNode aPreviousNode = (AccessibleTreeNode)maXAccessibleToNode.put (
+ xContext,
+ aNode);
+ return aPreviousNode != aNode;
+ }
+
+ protected void RemoveNode (AccessibleTreeNode aNode)
+ {
+ try
+ {
+ if ((aNode != null) && (aNode instanceof AccTreeNode))
+ {
+ maXAccessibleToNode.remove (((AccTreeNode)aNode).getContext());
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while removing node "
+ + aNode + " : " + e);
+ e.printStackTrace();
+ }
+ }
+
+
+ public void ForEach (NodeMapCallback aFunctor)
+ {
+ Object[] aNodes = maXAccessibleToNode.values().toArray();
+ for (int i=0; i<aNodes.length; i++)
+ {
+ if (aNodes[i] != null && (aNodes[i] instanceof AccTreeNode))
+ {
+ try
+ {
+ aFunctor.Apply ((AccTreeNode)aNodes[i]);
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception applying functor to "
+ + i + "th node " + aNodes[i] + " : " + e);
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ AccessibleTreeNode GetNode (XAccessibleContext xContext)
+ {
+ return (AccessibleTreeNode)maXAccessibleToNode.get (xContext);
+ }
+
+ AccessibleTreeNode GetNode (Object aObject)
+ {
+ if (aObject instanceof XAccessibleContext)
+ return GetNode ((XAccessibleContext)aObject);
+ else
+ return null;
+ }
+
+ XAccessibleContext GetAccessible (AccessibleTreeNode aNode)
+ {
+ if ((aNode != null) && (aNode instanceof AccTreeNode))
+ return ((AccTreeNode)aNode).getContext();
+ else
+ return null;
+ }
+
+ boolean IsMember (XAccessibleContext xContext)
+ {
+ return maXAccessibleToNode.containsKey(xContext);
+ }
+
+ boolean ValueIsMember (AccessibleTreeNode aNode)
+ {
+ return maXAccessibleToNode.containsValue(aNode);
+ }
+
+
+
+ private HashMap maXAccessibleToNode;
+}
diff --git a/toolkit/test/accessibility/OfficeConnection.java b/toolkit/test/accessibility/OfficeConnection.java
index 6def55c6b3d2..4cc5bee1ed78 100755
--- a/toolkit/test/accessibility/OfficeConnection.java
+++ b/toolkit/test/accessibility/OfficeConnection.java
@@ -18,10 +18,9 @@ import com.sun.star.uno.RuntimeException;
*/
public class OfficeConnection
{
- public OfficeConnection (Print p, int nPortNumber)
+ public OfficeConnection (int nPortNumber)
{
mnDefaultPort = nPortNumber;
- print = p;
connect ();
}
@@ -86,9 +85,9 @@ public class OfficeConnection
catch (Exception e)
{
- print.println ("Could not connect with " + sConnectString + " : " + e);
- print.println ("Please start OpenOffice/StarOffice with "
- + "\"-accept=socket,host=localhost,port=5678;urp;\"");
+ MessageArea.println ("Could not connect with " + sConnectString + " : " + e);
+ MessageArea.println ("Please start OpenOffice/StarOffice with "
+ + "\"-accept=socket,host=localhost,port=5678;urp;\"");
}
}
@@ -100,6 +99,4 @@ public class OfficeConnection
not that that has been successfull.
*/
private boolean mbInitialized = false;
-
- private Print print;
}
diff --git a/toolkit/test/accessibility/QueuedListener.java b/toolkit/test/accessibility/QueuedListener.java
new file mode 100644
index 000000000000..b1367f504b5a
--- /dev/null
+++ b/toolkit/test/accessibility/QueuedListener.java
@@ -0,0 +1,58 @@
+import drafts.com.sun.star.accessibility.*;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.*;
+import drafts.com.sun.star.accessibility.*;
+
+import java.util.LinkedList;
+
+class QueuedListener
+ implements XAccessibleEventListener
+{
+ public QueuedListener (EventListener aListener)
+ {
+ maListener = aListener;
+ }
+
+
+ public void disposing( final EventObject aEvent)
+ {
+ System.out.println( "Queue disposing: " + aEvent.hashCode() );
+
+ XAccessibleContext xContext = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, aEvent.Source);
+ if (xContext == null)
+ {
+ XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.Source);
+ if (xAccessible != null)
+ xContext = xAccessible.getAccessibleContext();
+ }
+ final XAccessibleContext xSource = xContext;
+ EventQueue.Instance().addDisposingEvent (new Runnable()
+ {
+ public void run()
+ {
+ if (QueuedListener.this.maListener != null)
+ QueuedListener.this.maListener.disposing (xSource);
+ }
+ }
+ );
+ }
+
+ public void notifyEvent( final AccessibleEventObject aEvent )
+ {
+ System.out.println( "Queue notifyEvent: " + aEvent.hashCode() );
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedListener.this.maListener.notifyEvent( aEvent );
+ }
+ }
+ );
+ }
+
+ private EventListener maListener;
+}
+
+
diff --git a/toolkit/test/accessibility/QueuedTopWindowListener.java b/toolkit/test/accessibility/QueuedTopWindowListener.java
new file mode 100644
index 000000000000..be9a4207179f
--- /dev/null
+++ b/toolkit/test/accessibility/QueuedTopWindowListener.java
@@ -0,0 +1,93 @@
+import com.sun.star.awt.XTopWindowListener;
+import com.sun.star.lang.EventObject;
+
+class QueuedTopWindowListener
+ implements XTopWindowListener
+{
+ public QueuedTopWindowListener (TopWindowListener aListener)
+ {
+ System.out.println ("starting new queued top window listener");
+ maListener = aListener;
+ }
+
+ public void windowOpened (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window opened: " + aEvent.Source);
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedTopWindowListener.this.maListener.windowOpened (aEvent);
+ }
+ }
+ );
+ }
+
+
+
+
+ public void windowClosing (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window closing: " + aEvent);
+ }
+
+
+
+
+ public void windowClosed (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window closed: " + aEvent);
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedTopWindowListener.this.maListener.windowClosed (aEvent);
+ }
+ }
+ );
+ }
+
+
+
+
+ public void windowMinimized (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window minimized: " + aEvent);
+ }
+
+ public void windowNormalized (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window normalized: " + aEvent);
+ }
+
+ public void windowActivated (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window actived: " + aEvent);
+ }
+
+ public void windowDeactivated (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window deactived: " + aEvent);
+ }
+
+ public void disposing( final EventObject aEvent)
+ {
+ System.out.println( "QueueTopWindowListener disposing: " + aEvent.hashCode() );
+ EventQueue.Instance().addDisposingEvent (new Runnable()
+ {
+ public void run()
+ {
+ if (QueuedTopWindowListener.this.maListener != null)
+ QueuedTopWindowListener.this.maListener.disposing (aEvent);
+ }
+ }
+ );
+ }
+
+
+ private TopWindowListener maListener;
+}
diff --git a/toolkit/test/accessibility/SimpleOffice.java b/toolkit/test/accessibility/SimpleOffice.java
index 8c8016da6cae..fc0204bc225e 100755
--- a/toolkit/test/accessibility/SimpleOffice.java
+++ b/toolkit/test/accessibility/SimpleOffice.java
@@ -48,24 +48,21 @@ import drafts.com.sun.star.awt.XExtendedToolkit;
getting various objects.
*/
public class SimpleOffice
- implements Print
{
XDesktop mxDesktop = null;
- Print maPrinter;
OfficeConnection aConnection;
int mnPortNumber;
- public SimpleOffice (Print aPrinter, int nPortNumber)
+ public SimpleOffice (int nPortNumber)
{
mnPortNumber = nPortNumber;
- maPrinter = aPrinter;
connect ();
getDesktop ();
}
public void connect ()
{
- aConnection = new OfficeConnection (maPrinter, mnPortNumber);
+ aConnection = new OfficeConnection (mnPortNumber);
mxDesktop = null;
getDesktop ();
}
@@ -92,12 +89,12 @@ public class SimpleOffice
}
catch (java.lang.NullPointerException e)
{
- println ("caught exception while loading "
+ MessageArea.println ("caught exception while loading "
+ URL + " : " + e);
}
catch (Exception e)
{
- println ("caught exception while loading "
+ MessageArea.println ("caught exception while loading "
+ URL + " : " + e);
}
return xModel;
@@ -120,12 +117,12 @@ public class SimpleOffice
{
XTask xTask = (XTask) UnoRuntime.queryInterface(
XTask.class, xE.nextElement());
- print (xTask.getName());
+ MessageArea.print (xTask.getName());
}
}
catch (Exception e)
{
- println ("caught exception while getting Model " + name
+ MessageArea.println ("caught exception while getting Model " + name
+ ": " + e);
}
return xModel;
@@ -140,7 +137,7 @@ public class SimpleOffice
return xController.getModel();
else
{
- println ("can't cast view to controller");
+ MessageArea.println ("can't cast view to controller");
return null;
}
}
@@ -155,11 +152,11 @@ public class SimpleOffice
XMultiServiceFactory xMSF = aConnection.getServiceManager ();
if (xMSF == null)
{
- println ("can't connect to office");
+ MessageArea.println ("can't connect to office");
return null;
}
else
- println ("Connected successfully.");
+ MessageArea.println ("Connected successfully.");
// Create a new desktop.
mxDesktop = (XDesktop) UnoRuntime.queryInterface(
@@ -169,7 +166,7 @@ public class SimpleOffice
}
catch (Exception e)
{
- println ("caught exception while creating desktop: "
+ MessageArea.println ("caught exception while creating desktop: "
+ e);
}
@@ -197,7 +194,7 @@ public class SimpleOffice
}
catch (Exception e)
{
- println ("caught exception while creating extended toolkit: " + e);
+ MessageArea.println ("caught exception while creating extended toolkit: " + e);
}
return xToolkit;
@@ -215,7 +212,7 @@ public class SimpleOffice
}
catch (Exception e)
{
- println (
+ MessageArea.println (
"caught exception while getting accessible object" + e);
e.printStackTrace();
}
@@ -241,7 +238,7 @@ public class SimpleOffice
}
catch (Exception e)
{
- println (
+ MessageArea.println (
"caught exception while getting accessible root" + e);
e.printStackTrace();
}
@@ -270,20 +267,20 @@ public class SimpleOffice
try
{
if (xModel == null)
- println ("invalid model (==null)");
+ MessageArea.println ("invalid model (==null)");
XController xController = xModel.getCurrentController();
if (xController == null)
- println ("can't get controller from model");
+ MessageArea.println ("can't get controller from model");
XFrame xFrame = xController.getFrame();
if (xFrame == null)
- println ("can't get frame from controller");
+ MessageArea.println ("can't get frame from controller");
xWindow = xFrame.getComponentWindow ();
if (xWindow == null)
- println ("can't get window from frame");
+ MessageArea.println ("can't get window from frame");
}
catch (Exception e)
{
- println ("caught exception while getting current window" + e);
+ MessageArea.println ("caught exception while getting current window" + e);
}
return xWindow;
@@ -307,13 +304,13 @@ public class SimpleOffice
try
{
if (xView == null)
- println ("can't get current draw page from null view");
+ MessageArea.println ("can't get current draw page from null view");
else
xPage = xView.getCurrentPage();
}
catch (Exception e)
{
- println ("caught exception while getting current draw page : " + e);
+ MessageArea.println ("caught exception while getting current draw page : " + e);
}
return xPage;
@@ -332,31 +329,31 @@ public class SimpleOffice
public XDrawView getCurrentView (XDesktop xDesktop)
{
if (xDesktop == null)
- println ("can't get desktop to retrieve current view");
+ MessageArea.println ("can't get desktop to retrieve current view");
XDrawView xView = null;
try
{
XComponent xComponent = xDesktop.getCurrentComponent();
if (xComponent == null)
- println ("can't get component to retrieve current view");
+ MessageArea.println ("can't get component to retrieve current view");
XFrame xFrame = xDesktop.getCurrentFrame();
if (xFrame == null)
- println ("can't get frame to retrieve current view");
+ MessageArea.println ("can't get frame to retrieve current view");
XController xController = xFrame.getController();
if (xController == null)
- println ("can't get controller to retrieve current view");
+ MessageArea.println ("can't get controller to retrieve current view");
xView = (XDrawView) UnoRuntime.queryInterface(
XDrawView.class, xController);
if (xView == null)
- println ("could not cast controller into view");
+ MessageArea.println ("could not cast controller into view");
}
catch (Exception e)
{
- println ("caught exception while getting current view : " + e);
+ MessageArea.println ("caught exception while getting current view : " + e);
}
return xView;
@@ -389,17 +386,4 @@ public class SimpleOffice
else
return null;
}
-
-
-
-
- public void print (String text)
- {
- maPrinter.print (text);
- }
-
- public void println (String text)
- {
- maPrinter.println (text);
- }
}
diff --git a/toolkit/test/accessibility/TableEventHandler.java b/toolkit/test/accessibility/TableEventHandler.java
new file mode 100644
index 000000000000..c1a6b0b7265b
--- /dev/null
+++ b/toolkit/test/accessibility/TableEventHandler.java
@@ -0,0 +1,43 @@
+import drafts.com.sun.star.accessibility.XAccessible;
+import drafts.com.sun.star.accessibility.AccessibleEventObject;
+import drafts.com.sun.star.accessibility.AccessibleEventId;
+import drafts.com.sun.star.accessibility.AccessibleTableModelChange;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+class TableEventHandler
+ extends EventHandler
+{
+ public TableEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ switch (mnEventId)
+ {
+ case AccessibleEventId.ACCESSIBLE_TABLE_MODEL_EVENT:
+ AccessibleTableModelChange aModelChange =
+ (AccessibleTableModelChange)maEvent.NewValue;
+ out.println( "Range: StartRow " + aModelChange.FirstRow +
+ " StartColumn " + aModelChange.FirstColumn +
+ " EndRow " + aModelChange.LastRow +
+ " EndColumn " + aModelChange.LastColumn +
+ " Id " + aModelChange.Type);
+ break;
+ default:
+ super.PrintOldAndNew (out);
+ }
+ }
+
+ public void Process ()
+ {
+ maTreeModel.updateNode (mxEventSource, AccessibleTableHandler.class);
+ }
+
+
+ private XAccessible mxOldChild;
+ private XAccessible mxNewChild;
+}
diff --git a/toolkit/test/accessibility/TextLogger.java b/toolkit/test/accessibility/TextLogger.java
new file mode 100644
index 000000000000..9d75964129af
--- /dev/null
+++ b/toolkit/test/accessibility/TextLogger.java
@@ -0,0 +1,30 @@
+import javax.swing.JEditorPane;
+import javax.swing.text.Document;
+import java.net.URL;
+
+class TextLogger
+ extends JEditorPane
+{
+ public TextLogger ()
+ {
+// maDocument = getEditorKit().createDefaultDocument();
+ try
+ {
+ setPage (new URL ("http://www.spiegel.de"));
+ }
+ catch (Exception e)
+ {}
+ }
+
+ public void appendText (String sText)
+ {
+ try
+ {
+ maDocument.insertString (maDocument.getLength(), sText, null);
+ }
+ catch (javax.swing.text.BadLocationException e)
+ {}
+ }
+
+ private Document maDocument;
+}
diff --git a/toolkit/test/accessibility/TopWindowListener.java b/toolkit/test/accessibility/TopWindowListener.java
index 6d34da1247d4..b3549e148d5e 100644
--- a/toolkit/test/accessibility/TopWindowListener.java
+++ b/toolkit/test/accessibility/TopWindowListener.java
@@ -1,4 +1,3 @@
-import com.sun.star.awt.XTopWindowListener;
import com.sun.star.awt.XWindow;
import drafts.com.sun.star.awt.XExtendedToolkit;
import drafts.com.sun.star.accessibility.XAccessible;
@@ -10,7 +9,6 @@ import javax.swing.event.TreeModelEvent;
model accordingly.
*/
class TopWindowListener
- implements XTopWindowListener
{
TopWindowListener (AccessibilityTreeModel aModel, SimpleOffice aOffice)
{
@@ -44,7 +42,8 @@ class TopWindowListener
}
catch (Exception e)
{
- System.out.println ("caught exception; " + e);
+ System.out.println ("caught exception: " + e);
+ e.printStackTrace();
}
}
maModel.unlock ((AccessibleTreeNode)maModel.getRoot());
@@ -61,13 +60,13 @@ class TopWindowListener
private void AddTopLevelNode (XAccessible xNewTopLevelObject)
{
Object aObject = maModel.getRoot();
- System.out.println ("adding node to " + aObject);
+ if ((xNewTopLevelObject != null) && xNewTopLevelObject.getAccessibleContext()== null)
+ System.out.println ("top level window not accessible");
if (aObject instanceof VectorNode && xNewTopLevelObject != null)
{
- System.out.println ("adding node for " + xNewTopLevelObject);
VectorNode aRoot = (VectorNode) aObject;
AccessibleTreeNode aNode =
- AccessibilityTreeModel.createDefaultNode (xNewTopLevelObject, aRoot);
+ NodeFactory.Instance().createDefaultNode (xNewTopLevelObject, aRoot);
aRoot.addChild (aNode);
maModel.fireTreeNodesInserted (maModel.createEvent (aRoot, aNode));
}
@@ -87,11 +86,14 @@ class TopWindowListener
{
System.out.println ("removing node " + xTopLevelObject);
VectorNode aRoot = (VectorNode) aObject;
+ maModel.removeNode (xTopLevelObject.getAccessibleContext());
+ /*
AccessibleTreeNode aNode = maModel.getNode (xTopLevelObject);
TreeModelEvent aEvent = maModel.createEvent (aRoot, aNode);
maModel.removeChild (aNode);
System.out.println (aNode);
maModel.fireTreeNodesRemoved (aEvent);
+ */
}
}
@@ -126,7 +128,8 @@ class TopWindowListener
// XTopWindowListener
- public void windowOpened (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ public void windowOpened (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
{
System.out.println ("Top window opened: " + aEvent.Source);
if (maModel != null)
@@ -141,7 +144,7 @@ class TopWindowListener
if (xAccessible == null)
System.out.println ("event source is no XAccessible");
else
- AddTopLevelNode (xAccessible);
+ AddTopLevelNode (xAccessible);
}
}
}
@@ -149,15 +152,8 @@ class TopWindowListener
- public void windowClosing (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Top window closing: " + aEvent);
- }
-
-
-
-
- public void windowClosed (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ public void windowClosed (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
{
System.out.println ("Top window closed: " + aEvent);
if (maModel != null)
@@ -177,31 +173,13 @@ class TopWindowListener
}
}
-
-
-
- public void windowMinimized (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ public void disposing (final com.sun.star.lang.EventObject aEvent)
{
- System.out.println ("Top window minimized: " + aEvent);
- }
- public void windowNormalized (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Top window normalized: " + aEvent);
- }
- public void windowActivated (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Top window actived: " + aEvent);
- }
- public void windowDeactivated (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
- {
- System.out.println ("Top window deactived: " + aEvent);
+ System.out.println ("Top window disposed: " + aEvent);
}
- // XEventListener
- public void disposing (com.sun.star.lang.EventObject aEvent)
- {
- System.out.println ("broadcaster disposed");
- }
+
+
private AccessibilityTreeModel
maModel;
diff --git a/toolkit/test/accessibility/makefile.mk b/toolkit/test/accessibility/makefile.mk
index 2dbce9304f63..dcad9452e990 100644
--- a/toolkit/test/accessibility/makefile.mk
+++ b/toolkit/test/accessibility/makefile.mk
@@ -26,40 +26,55 @@ JAR_FILES = \
juh.jar \
java_uno.jar
-JAVA_FILES = \
- AccTreeNode.java \
- AccessibilityTree.java \
- AccessibilityTreeModel.java \
- AccessibilityWorkBench.java \
- AccessibleActionHandler.java \
- AccessibleActionNode.java \
- AccessibleCellHandler.java \
- AccessibleComponentHandler.java \
- AccessibleContextHandler.java \
- AccessibleEditableTextHandler.java \
+JAVA_FILES = \
+ AccTreeNode.java \
+ AccessibilityTree.java \
+ AccessibilityTreeModel.java \
+ AccessibilityTreeModelBase.java \
+ AccessibilityWorkBench.java \
+ AccessibleActionHandler.java \
+ AccessibleActionNode.java \
+ AccessibleCellHandler.java \
+ AccessibleComponentHandler.java \
+ AccessibleContextHandler.java \
+ AccessibleEditableTextHandler.java \
AccessibleExtendedComponentHandler.java \
- AccessibleHyperlinkHandler.java \
- AccessibleHypertextHandler.java \
- AccessibleImageHandler.java \
- AccessibleObject.java \
- AccessibleRelationHandler.java \
- AccessibleSelectionHandler.java \
- AccessibleTableHandler.java \
- AccessibleTextHandler.java \
- AccessibleTreeCellRenderer.java \
- AccessibleTreeHandler.java \
- AccessibleTreeNode.java \
- AccessibleUNOHandler.java \
- Canvas.java \
- FrameActionListener.java \
- InformationWriter.java \
- MessageInterface.java \
- NodeHandler.java \
- OfficeConnection.java \
- Print.java \
- SimpleOffice.java \
- StringNode.java \
- TopWindowListener.java \
+ AccessibleHyperlinkHandler.java \
+ AccessibleHypertextHandler.java \
+ AccessibleImageHandler.java \
+ AccessibleObject.java \
+ AccessibleRelationHandler.java \
+ AccessibleSelectionHandler.java \
+ AccessibleTableHandler.java \
+ AccessibleTextHandler.java \
+ AccessibleTreeCellRenderer.java \
+ AccessibleTreeHandler.java \
+ AccessibleTreeNode.java \
+ AccessibleUNOHandler.java \
+ Canvas.java \
+ ChildEventHandler.java \
+ ContextEventHandler.java \
+ EventHandler.java \
+ EventListener.java \
+ EventLogger.java \
+ EventQueue.java \
+ FrameActionListener.java \
+ GeometryEventHandler.java \
+ InformationWriter.java \
+ MessageArea.java \
+ NameProvider.java \
+ NodeFactory.java \
+ NodeHandler.java \
+ NodeMap.java \
+ OfficeConnection.java \
+ QueuedListener.java \
+ QueuedTopWindowListener.java \
+ SimpleOffice.java \
+ StringNode.java \
+ TableEventHandler.java \
+ TextLogger.java \
+ TextUpdateListener.java \
+ TopWindowListener.java \
VectorNode.java
@@ -85,6 +100,6 @@ AccessibilityWorkBench.jar: $(JAVA_FILES:b:+".class") jawb.mf
+jar -cfm AccessibilityWorkBench.jar jawb.mf *.class
# Example of how to run the work bench.
-run:
+run: all
+$(JAVA) -classpath $(CLASSPATH) AccessibilityWorkBench -p $(PORT_NUMBER)