Author: tchemit Date: 2010-06-23 11:51:19 +0200 (Wed, 23 Jun 2010) New Revision: 1989 Url: http://nuiton.org/repositories/revision/jaxx/1989 Log: improve BusyChangeListener Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java 2010-06-23 08:59:55 UTC (rev 1988) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/BusyChangeListener.java 2010-06-23 09:51:19 UTC (rev 1989) @@ -24,6 +24,7 @@ */ package jaxx.runtime.swing.wizard; +import jaxx.runtime.swing.BlockingLayerUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -49,6 +50,8 @@ protected final Component ui; + protected BlockingLayerUI blockingUI; + public BusyChangeListener(Component ui) { this.ui = ui; } @@ -57,6 +60,10 @@ return ui; } + public BlockingLayerUI getBlockingUI() { + return blockingUI; + } + @Override public void propertyChange(PropertyChangeEvent evt) { Boolean value = (Boolean) evt.getNewValue(); @@ -64,22 +71,35 @@ log.debug("busy state changed to " + value); } if (value != null && value) { - setBusy(ui, getBusyCursor()); + setBusy(ui); - } else { - setUnBusy(ui, getDefaultCursor()); + setUnBusy(ui); } } - protected void setBusy(Component ui, Cursor busyCursor) { - ui.setCursor(busyCursor); + public void setBlockingUI(BlockingLayerUI blockingUI) { + this.blockingUI = blockingUI; } - protected void setUnBusy(Component ui, Cursor unbusyCursor) { - ui.setCursor(unbusyCursor); + protected void setBusy(Component ui) { + if (ui != null) { + ui.setCursor(getBusyCursor()); + } + if (blockingUI != null) { + blockingUI.setBlock(true); + } } + protected void setUnBusy(Component ui) { + if (ui != null) { + ui.setCursor(getDefaultCursor()); + } + if (blockingUI != null) { + blockingUI.setBlock(false); + } + } + protected Cursor getBusyCursor() { if (busyCursor == null) { busyCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);