/* (non-Javadoc)
  * @see Displayable#addCommand(Command)
  */
 public void addCommand(Command command) {
   if (command != DISMISS_COMMAND) {
     super.addCommand(command);
     super.removeCommand(DISMISS_COMMAND);
     setCommandsVisibility(isModal());
   }
 }
 /* (non-Javadoc)
  * @see Displayable#removeCommand(Command)
  */
 public void removeCommand(Command command) {
   if (command != DISMISS_COMMAND) {
     super.removeCommand(command);
     if (getNumCommands() == 0) {
       super.addCommand(DISMISS_COMMAND);
     }
     setCommandsVisibility(isModal());
   }
 }
 /**
  * Create a new Alert with the specified title, text, image, and alert type.
  *
  * @param title the title string
  * @param text the text string
  * @param image the image
  * @param type the alert type
  */
 public Alert(String title, String text, Image image, AlertType type) {
   super(title);
   construct();
   this.type = type;
   setImage(image);
   setString(text);
   setTimeout(getDefaultTimeout());
   super.addCommand(DISMISS_COMMAND);
   super.setCommandListener(implicitListener);
 }
 /** Dispose Alert. */
 void dispose() {
   super.dispose();
   ESWTUIThreadRunner.syncExec(
       new Runnable() {
         public void run() {
           topShell.dispose();
         }
       });
 }
  /* (non-Javadoc)
   * @see javax.microedition.lcdui.Displayable#handleHideEvent()
   */
  void eswtHandleHideCurrentEvent() {
    super.eswtHandleHideCurrentEvent();
    topShell.removeListener(SWT.Resize, resizeListener);

    nextDisplayable = null;
    resetTimerTask(false);

    // remove key filter for scrollable text composite
    org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.KeyDown, keyListener);
    org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.Traverse, keyListener);
    org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.MouseUp, keyListener);
  }
  /* (non-Javadoc)
   * @see javax.microedition.lcdui.Displayable#handleShowEvent()
   */
  void eswtHandleShowCurrentEvent() {
    // If it alert is first displayable, default
    // displayable should be shown behind alert
    if (topShell.isVisible() == false && nextDisplayable == null) {
      topShell.setVisible(true);
    }
    super.eswtHandleShowCurrentEvent();
    topShell.addListener(SWT.Resize, resizeListener);

    // add key filter for scrollable text composite
    org.eclipse.swt.widgets.Display.getCurrent().addFilter(SWT.KeyDown, keyListener);
    org.eclipse.swt.widgets.Display.getCurrent().addFilter(SWT.Traverse, keyListener);
    org.eclipse.swt.widgets.Display.getCurrent().addFilter(SWT.MouseUp, keyListener);
    resetTimerTask(true);
  }
 /* (non-Javadoc)
  * @see Displayable#setCommandListener(CommandListener)
  */
 public void setCommandListener(CommandListener listener) {
   if (listener == null) {
     listener = implicitListener;
   }
   super.setCommandListener(listener);
 }