Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.ide.controls
Class WaitCursor

java.lang.Object
  extended by oracle.ide.controls.WaitCursor

public class WaitCursor
extends java.lang.Object

This class handles the wait cursor over the application and dialogs. The show/hide methods increment/decrement a counter for each window and the wait cursor is removed only when the counter==0.

All you have to do to show and hide the wait cursor is to call show(), do your long operation then call hide(). If you are showing the wait cursor from a dialog, do this:

 import oracle.ide.controls.WaitCursor;
 // ...
 public void doSomeLongOperation()
 {
   WaitCursor wc = new WaitCursor(window1);
   wc.show();
   //...
   wc.hide();
 }
 
If you are showing the wait cursor from the IDE, do this:
 import oracle.ide.Ide;
 // ...
 public void rebuildTheWorld()
 {
   WaitCursor wc = new WaitCursor(Ide.getMainWindow());
   wc.show();
   //...
   wc.hide();
 }
 
Typical usage is to spawn a thread. The process goes like this: create a wait cursor, show it, create a thread, do some stuff then hide the wait cursor:
 import oracle.ide.controls.WaitCursor;
 // ...
 public void doSomeLongOperation()
 {
   WaitCursor wc = new WaitCursor(window1);
   wc.show();
   Thread thread = new Thread("")
   {
     public void run()
     {
       try
       {
         //...
       }
       finally
       {
         wc.hide();
       }
     }
   }
 }
 
Although this class is not marked final, extension writers should not subclass it..


Constructor Summary
WaitCursor()
          Deprecated. since 11.1.1 Use WaitCursor(Component). This constructor will be removed.
WaitCursor(java.awt.Component component)
          Attaches WaitCursor to the RootPaneContainer of the specified Component.
 
Method Summary
 void attach(javax.swing.RootPaneContainer rootPaneContainer)
          Deprecated. since 11.1.1. Instead of calling this method, clients should construct a new instance of WaitCursor, passing in the root pane container component in the constructor. In particular, clients should never call the attach method on the WaitCursor instance returned by Ide#getWaitCursor(), since doing so will almost certainly leak memory.
 void detach(javax.swing.RootPaneContainer rootPaneContainer)
          Deprecated. since 11.1.1. Instead of attaching and detatching from specific root panes, clients should construct new WaitCursor instances for new root panes using the WaitCursor(Component) API. If you want to force a wait cursor to detach from all of its attached root panes, you should call dispose(). Note that the WaitCursor returned from Ide#getWaitCursor() does not support the dispose() method, and will throw an exception if you attempt to use it.
 void dispose()
          Deprecated. since 11.1.2.0.0. Currently no replacement.
protected  void finalize()
          Deprecated. since 11.1.2.0.0. Currently no replacement. This function will be removed.
protected  javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component component)
          Deprecated. since 11.1.2.0.0. Currently no replacement. This function will become private.
 void hide()
          Deprecated. since 11.1.2.0.0. Currently no replacement.
 void show()
          Deprecated. 
 void show(int delay)
          Deprecated. since 11.1.2.0.0. Currently no replacement.
 void show(long delay)
          Deprecated. since 11.1.1.0.0. Use #show(int).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitCursor

@Deprecated
public WaitCursor()
Deprecated. since 11.1.1 Use WaitCursor(Component). This constructor will be removed.


WaitCursor

public WaitCursor(java.awt.Component component)
Attaches WaitCursor to the RootPaneContainer of the specified Component.

Method Detail

findRootPaneContainer

@Deprecated
protected final javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component component)
Deprecated. since 11.1.2.0.0. Currently no replacement. This function will become private.


finalize

@Deprecated
protected void finalize()
Deprecated. since 11.1.2.0.0. Currently no replacement. This function will be removed.

Overrides:
finalize in class java.lang.Object

attach

@Deprecated
public void attach(javax.swing.RootPaneContainer rootPaneContainer)
Deprecated. since 11.1.1. Instead of calling this method, clients should construct a new instance of WaitCursor, passing in the root pane container component in the constructor. In particular, clients should never call the attach method on the WaitCursor instance returned by Ide#getWaitCursor(), since doing so will almost certainly leak memory.

Installs the manager on the specified RootPaneContainer. This method is used by the IDE. You should only use show() and hide().

Note that, if called on the WaitCursor instance returned by Ide#getWaitCursor(), this method will dump a diagnostic trace to stderr. You can fix this by using a new WaitCursor instance instead of the one returned by Ide.getWaitCursor().

Throws:
java.lang.IllegalStateException - if called after dispose().

detach

@Deprecated
public void detach(javax.swing.RootPaneContainer rootPaneContainer)
Deprecated. since 11.1.1. Instead of attaching and detatching from specific root panes, clients should construct new WaitCursor instances for new root panes using the WaitCursor(Component) API. If you want to force a wait cursor to detach from all of its attached root panes, you should call dispose(). Note that the WaitCursor returned from Ide#getWaitCursor() does not support the dispose() method, and will throw an exception if you attempt to use it.

De-installs the manager from the specified RootPaneContainer. This method is used by the IDE. You should only use show() and hide().

Throws:
java.lang.IllegalStateException - if called after dispose().

dispose

@Deprecated
public void dispose()
Deprecated. since 11.1.2.0.0. Currently no replacement.

Detaches this WaitCursor from any _items it is attached to. This is the prefered way to ensure that any references to _items held by a WaitCursor are released (although it may not be necessary, since those _items may be unreachable, and therefore garbage collectable anyway).

Calling this method on the WaitCursor returned from Ide#getWaitCursor() is not supported, and will throw an UnsupportedOperationException.

Once this WaitCursor instance has been disposed, it can no longer be used. Calling show()or hide()on it will result in an IllegalStateException.

Throws:
java.lang.UnsupportedOperationException - if you call this method on the WaitCursor instance returned from Ide#getWaitCursor().
Since:
11.1.1

show

@Deprecated
public void show()
Deprecated. 

Shows the wait cursor after DEFAULT_DELAY number of milliseconds has elapsed.

Throws:
java.lang.IllegalStateException - if called after dispose().

show

public final void show(int delay)
Deprecated. since 11.1.2.0.0. Currently no replacement.

Schedules the wait cursor to be shown after the specified number of milliseconds has elapsed. If hide() is called before the delay has elapsed, then the WaitCursor is not shown.

Parameters:
delay - the number of milliseconds to delay before showing the wait cursor.
Throws:
java.lang.IllegalStateException - if called after dispose().

show

@Deprecated
public void show(long delay)
Deprecated. since 11.1.1.0.0. Use #show(int).

Schedules the wait cursor to be shown after the specified number of milliseconds has elapsed. If hide() is called before the delay has elapsed, then the WaitCursor is not shown.

Parameters:
delay - the number of milliseconds to delay before showing the wait cursor.
Throws:
java.lang.IllegalStateException - if called after dispose().

hide

public void hide()
Deprecated. since 11.1.2.0.0. Currently no replacement.

Hides the wait cursor if visible.

Note that hide() must be called as many times as show() to clear all pending cursor display calls. Calls to hide() will always cancel calls to show() in FILO order. consider the following scenario:

  show(1000) // s1
  show(3000) // s2
  // wait 500 ms
  hide()
  
Calling hide() at 500ms will cancel s2 but not s1 thus resulting in the cursor being shown after 500ms.

Throws:
java.lang.IllegalStateException - if called after dispose().

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.