001 /** ===================================================================== 002 * 003 * File Name : $Id: BusyIndicator.java,v 1.2 2007/08/17 14:21:56 cb Exp $ 004 * 005 * Description 006 * ----------- 007 * 008 * See javadoc comment 009 * 010 * ===================================================================== 011 * 012 * @Author : Craige Bevil 013 * Control Software Group 014 * Isaac Newton Group of Telescopes 015 * 016 * ===================================================================== 017 * 018 * Modification Log 019 * 020 * Vers Date Author Reason 021 * ---- ---- ------ ------ 022 * 1 C.Bevil First Release 023 * 024 * Commissioning Notes 025 * ------------------- 026 * 027 * None 028 * 029 * ===================================================================== 030 * 031 * @Version : $Id: BusyIndicator.java,v 1.2 2007/08/17 14:21:56 cb Exp $ 032 * 033 * @Author : $Author: cb $ 034 * 035 * Header : $Header: /opt/INGsrc/src/CVS/softproj/FaultDatabase/src/FaultDatabase/FaultDatabase/src/GWTApplication/client/BusyIndicator.java,v 1.2 2007/08/17 14:21:56 cb Exp $ 036 * 037 * Log : $Log: BusyIndicator.java,v $ 038 * Log : Revision 1.2 2007/08/17 14:21:56 cb 039 * Log : Removed dead code, changed the position of it's display 040 * Log : 041 * Log : Revision 1.1 2007/08/08 16:17:05 cb 042 * Log : First version 043 * Log : 044 * 045 * =====================================================================*/ 046 047 048 package GWTApplication.client; 049 050 import com.google.gwt.core.client.GWT; 051 import com.google.gwt.user.client.*; 052 import com.google.gwt.user.client.rpc.*; 053 import com.google.gwt.user.client.ui.*; 054 import com.google.gwt.user.client.ui.DockPanel.*; 055 056 import com.google.gwt.user.client.ui.FlexTable.*; 057 import java.util.*; 058 059 /** 060 * This class will be used to display a red banner in the top right of 061 * the window to indicate to the user that the 062 * application is busy doing something. 063 * @author Craige Bevil 064 * @version $Id: BusyIndicator.java,v 1.2 2007/08/17 14:21:56 cb Exp $ 065 */ 066 067 public class BusyIndicator { 068 069 /** 070 * This is the popup panel which will be used to indicate to the 071 * user that we are busy. We make the dialog modal with no 072 * autohide. 073 */ 074 075 final private PopupPanel busyPanel = new PopupPanel(); 076 077 /** 078 * This class will be used for internationalization so that we can 079 * flick between the locales of English and Spanish. 080 */ 081 082 private InternationalizationConstants internationalizationConstants = (InternationalizationConstants) GWT.create(InternationalizationConstants.class); 083 084 /** 085 * This is the label which is used to display the message 086 */ 087 088 final Label busyLabel = new Label(internationalizationConstants.busy()); 089 090 /** 091 * Constructor 092 */ 093 094 BusyIndicator () { 095 096 busyPanel.add(busyLabel); 097 busyPanel.setStyleName("busyDialog"); 098 } 099 100 /** 101 * This is used to show that we are busy or not. It pops up a red 102 * box in the top right of the display indicating that we are 103 * currently busy doing something. 104 * @param showBusy True if we are to display a red box indicating 105 * that we are doing something. 106 */ 107 108 void showBusy (final boolean showBusy) { 109 showBusy(showBusy,internationalizationConstants.busy()); 110 } 111 112 /** 113 * This is used to show that we are busy or not. It pops up a red 114 * box in the top right of the display indicating that we are 115 * currently busy doing something. 116 * @param showBusy True if we are to display a red box indicating 117 * that we are doing something. 118 * @param message Message to be displayed 119 */ 120 121 void showBusy (final boolean showBusy,final String message) { 122 123 if (showBusy) { 124 busyLabel.setText(message); 125 busyPanel.setWidth("4cm"); 126 busyPanel.setPopupPosition(Window.getClientWidth() - 90,0); 127 busyPanel.show(); 128 busyPanel.setVisible(true); 129 } else { 130 busyPanel.hide(); 131 } 132 } 133 }