1 import com.sun.star.awt.XTopWindowListener; 2 import com.sun.star.lang.EventObject; 3 4 class QueuedTopWindowListener 5 implements XTopWindowListener 6 { 7 public QueuedTopWindowListener (TopWindowListener aListener) 8 { 9 maListener = aListener; 10 } 11 12 public void windowOpened (final com.sun.star.lang.EventObject aEvent) throws RuntimeException 13 { 14 EventQueue.Instance().addEvent (new Runnable() 15 { 16 public void run() 17 { 18 QueuedTopWindowListener.this.maListener.windowOpened (aEvent); 19 } 20 } 21 ); 22 } 23 24 25 26 27 public void windowClosing (final com.sun.star.lang.EventObject aEvent) throws RuntimeException 28 { 29 // Ignored. 30 } 31 32 33 34 35 public void windowClosed (final com.sun.star.lang.EventObject aEvent) throws RuntimeException 36 { 37 EventQueue.Instance().addEvent (new Runnable() 38 { 39 public void run() 40 { 41 QueuedTopWindowListener.this.maListener.windowClosed (aEvent); 42 } 43 } 44 ); 45 } 46 47 48 49 50 public void windowMinimized (final com.sun.star.lang.EventObject aEvent) 51 throws RuntimeException 52 { 53 System.out.println ("QueuedTopWindowListener: Top window minimized: " + aEvent); 54 } 55 56 public void windowNormalized (final com.sun.star.lang.EventObject aEvent) 57 throws RuntimeException 58 { 59 System.out.println ("QueuedTopWindowListener: Top window normalized: " + aEvent); 60 } 61 62 public void windowActivated (final com.sun.star.lang.EventObject aEvent) 63 throws RuntimeException 64 { 65 System.out.println ("QueuedTopWindowListener: Top window actived: " + aEvent); 66 } 67 68 public void windowDeactivated (final com.sun.star.lang.EventObject aEvent) 69 throws RuntimeException 70 { 71 System.out.println ("QueuedTopWindowListener: Top window deactived: " + aEvent); 72 } 73 74 public void disposing( final EventObject aEvent) 75 { 76 EventQueue.Instance().addDisposingEvent (new Runnable() 77 { 78 public void run() 79 { 80 if (QueuedTopWindowListener.this.maListener != null) 81 QueuedTopWindowListener.this.maListener.disposing (aEvent); 82 } 83 } 84 ); 85 } 86 87 private TopWindowListener maListener; 88 } 89