com.sdm.quasar.client.swing.dialog.services.impl
Class SwingModalBlockHelperService

java.lang.Object
  extended bycom.sdm.quasar.client.swing.dialog.services.impl.SwingModalBlockHelperService
All Implemented Interfaces:
ModalBlockHelperService, Service

public class SwingModalBlockHelperService
extends java.lang.Object
implements ModalBlockHelperService

Default implementation for com.sdm.quasar.client.core.common.util.ModalBlockWorkaroundWorker for Swing's modal dialogs. This implementation's constructor stores this instance in a thread local variable in the EDT thread so that static access to actually support an expected switch in the event queue works. It is not possible to create more than one instance per EDT thread.

Version:
1.0
Author:
Bernd Olleck, sd&m AG

Nested Class Summary
 
Nested classes inherited from class com.sdm.quasar.client.core.dialog.services.ModalBlockHelperService
ModalBlockHelperService.JobQueue
 
Constructor Summary
SwingModalBlockHelperService()
           
 
Method Summary
static void showDialogAndContinueActivation(java.awt.Dialog dialog)
          This method must be called when a modal dialog should be displayed.
 void startJob(ModalBlockHelperService.JobQueue jobQueue)
          This processes the job queue until it is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingModalBlockHelperService

public SwingModalBlockHelperService()
Method Detail

startJob

public void startJob(ModalBlockHelperService.JobQueue jobQueue)
This processes the job queue until it is empty. When a modal dialog should be displayed, a call to showDialogAndContinueActivation(Dialog) must be called. That adds a Runnable to execute the job queue in the current EDT event queue using SwingUtilities.invokeLater(java.lang.Runnable).

This has the following effect:

Specified by:
startJob in interface ModalBlockHelperService
Parameters:
jobQueue - the job queue to be processed
See Also:
ModalBlockWorkaroundWorker#startJob(JobQueue)

showDialogAndContinueActivation

public static void showDialogAndContinueActivation(java.awt.Dialog dialog)
This method must be called when a modal dialog should be displayed. The implementation will call Dialog.show() on the given dialog but also ensure that the activation life cycle will complete despite the blocking call.

This method must only be called in the EDT.

Parameters:
dialog - the modal dialog to show