slidecopy: in the event logger, display event numbers / revoke the ObjectViewContainer as listener from unselected nodes, to not display their events/properties (which is confusing especially in the case of the event logger)
This commit is contained in:
parent
e3c620fd03
commit
52308ad926
3 changed files with 35 additions and 24 deletions
|
@ -588,28 +588,39 @@ public class AccessibilityWorkBench
|
|||
javax.swing.tree.TreePath aPath = aEvent.getPath();
|
||||
maTree.scrollPathToVisible (aPath);
|
||||
Object aObject = aPath.getLastPathComponent();
|
||||
if (aObject instanceof XAccessible) {
|
||||
XAccessible xAccessible = (XAccessible) aObject;
|
||||
if (maObjectViewContainer != null) {
|
||||
((AccessibilityModel) maTree.getModel()).addEventListener((TreeNode) aObject, maObjectViewContainer);
|
||||
maObjectViewContainer.SetObject (xAccessible.getAccessibleContext());
|
||||
}
|
||||
implSetCurrentObject( aObject );
|
||||
if (aObject instanceof XAccessible)
|
||||
{
|
||||
if (maObjectViewContainer != null)
|
||||
maObjectViewContainer.SetObject( ((XAccessible)aObject).getAccessibleContext() );
|
||||
}
|
||||
if (maCanvas != null)
|
||||
maCanvas.SelectObject ((TreeNode) aObject);
|
||||
setCursor (aCursor);
|
||||
} else {
|
||||
if (maObjectViewContainer != null) {
|
||||
((AccessibilityModel) maTree.getModel()).removeEventListener((TreeNode) aEvent.getPath().getLastPathComponent(), maObjectViewContainer);
|
||||
implSetCurrentObject( aEvent.getPath().getLastPathComponent() );
|
||||
if (maObjectViewContainer != null)
|
||||
maObjectViewContainer.SetObject (null);
|
||||
}
|
||||
if (maCanvas != null)
|
||||
maCanvas.SelectObject (null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void implSetCurrentObject( Object i_object )
|
||||
{
|
||||
if ( maObjectViewContainer == null )
|
||||
return;
|
||||
if ( maCurrentObject != null )
|
||||
{
|
||||
AccessibilityModel.removeEventListener( (TreeNode)maCurrentObject, maObjectViewContainer );
|
||||
}
|
||||
maCurrentObject = i_object;
|
||||
if ( maCurrentObject != null )
|
||||
{
|
||||
AccessibilityModel.addEventListener( (TreeNode)maCurrentObject, maObjectViewContainer );
|
||||
}
|
||||
}
|
||||
|
||||
// XEventListener
|
||||
public void disposing (EventObject aSourceObj)
|
||||
|
@ -687,4 +698,5 @@ public class AccessibilityWorkBench
|
|||
maShapesButton;
|
||||
private JMenuBar maMenuBar;
|
||||
private boolean mbInitialized;
|
||||
private Object maCurrentObject = null;
|
||||
}
|
||||
|
|
|
@ -75,8 +75,7 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible,
|
|||
if (xAccessibleContext != null) {
|
||||
try {
|
||||
XAccessibleEventBroadcaster xAccessibleEventBroadcaster =
|
||||
(XAccessibleEventBroadcaster) UnoRuntime.queryInterface(
|
||||
XAccessibleEventBroadcaster.class, xAccessibleContext);
|
||||
UnoRuntime.queryInterface( XAccessibleEventBroadcaster.class, xAccessibleContext );
|
||||
if (xAccessibleEventBroadcaster != null) {
|
||||
if (attach) {
|
||||
xAccessibleEventBroadcaster.addEventListener(this);
|
||||
|
@ -91,9 +90,9 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible,
|
|||
}
|
||||
|
||||
public void disposing(com.sun.star.lang.EventObject eventObject) {
|
||||
XAccessibleEventListener listener = this.listener;
|
||||
if (listener != null) {
|
||||
listener.disposing(eventObject);
|
||||
XAccessibleEventListener localListener = this.listener;
|
||||
if (localListener != null) {
|
||||
localListener.disposing(eventObject);
|
||||
}
|
||||
|
||||
treeModel.removeNode(userObject);
|
||||
|
@ -135,22 +134,20 @@ class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible,
|
|||
|
||||
public void notifyEvent(AccessibleEventObject accessibleEventObject) {
|
||||
if (accessibleEventObject.EventId == AccessibleEventId.CHILD) {
|
||||
XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
|
||||
XAccessible.class, accessibleEventObject.OldValue);
|
||||
XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.OldValue );
|
||||
if (xAccessible != null) {
|
||||
handleChildRemoved(xAccessible);
|
||||
}
|
||||
|
||||
xAccessible = (XAccessible) UnoRuntime.queryInterface(
|
||||
XAccessible.class, accessibleEventObject.NewValue);
|
||||
xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.NewValue );
|
||||
if (xAccessible != null) {
|
||||
handleChildAdded(xAccessible);
|
||||
}
|
||||
}
|
||||
|
||||
XAccessibleEventListener listener = this.listener;
|
||||
if (listener != null) {
|
||||
listener.notifyEvent(accessibleEventObject);
|
||||
XAccessibleEventListener localListener = this.listener;
|
||||
if (localListener != null) {
|
||||
localListener.notifyEvent(accessibleEventObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ class EventMonitorView
|
|||
public EventMonitorView (ObjectViewContainer aContainer)
|
||||
{
|
||||
super (aContainer);
|
||||
mnLineNo = 0;
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,7 @@ class EventMonitorView
|
|||
maScrollPane = new JScrollPane (maText,
|
||||
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||
maScrollPane.setPreferredSize (new Dimension (300,80));
|
||||
maScrollPane.setPreferredSize (new Dimension (300,200));
|
||||
|
||||
GridBagConstraints aConstraints = new GridBagConstraints ();
|
||||
aConstraints.weightx = 1;
|
||||
|
@ -112,7 +113,7 @@ class EventMonitorView
|
|||
|
||||
public void notifyEvent (AccessibleEventObject aEvent)
|
||||
{
|
||||
maText.append (NameProvider.getEventName (aEvent.EventId) + " : "
|
||||
maText.append ((mnLineNo++) + ". " + NameProvider.getEventName (aEvent.EventId) + " : "
|
||||
+ aEvent.OldValue.toString()
|
||||
+ " -> "
|
||||
+ aEvent.NewValue.toString() + "\n");
|
||||
|
@ -120,5 +121,6 @@ class EventMonitorView
|
|||
}
|
||||
|
||||
private JTextArea maText;
|
||||
private int mnLineNo;
|
||||
private JScrollPane maScrollPane;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue