home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 31 / SUPERCDa.iso / Inet / HotJava / hjava.exe / InstallerData / lax.jar / com / zerog / lax / ZGAppEventUtils.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-01-21  |  2.1 KB  |  84 lines

  1. package com.zerog.lax;
  2.  
  3. import java.io.File;
  4. import java.util.Enumeration;
  5. import java.util.Vector;
  6.  
  7. public class ZGAppEventUtils {
  8.    static final int ZGAPPEVENT_ABOUT = 1;
  9.    static final int ZGAPPEVENT_QUIT = 2;
  10.    static final int ZGAPPEVENT_FILE_OPEN = 3;
  11.    static final int ZGAPPEVENT_FILE_PRINT = 4;
  12.    static Vector listenerVector = new Vector();
  13.  
  14.    private ZGAppEventUtils() {
  15.       new Integer(4);
  16.       new StringBuffer();
  17.    }
  18.  
  19.    public static synchronized void addZGAppEventListener(ZGAppEventListener var0) {
  20.       new Integer(4);
  21.       new StringBuffer();
  22.       if (System.getProperty("os.name").equals("Mac OS") && listenerVector.isEmpty()) {
  23.          try {
  24.             ZGMRJAppEventUtils.registerWithMRJ();
  25.          } catch (ClassNotFoundException var2) {
  26.             System.err.println(((Throwable)var2).getLocalizedMessage());
  27.          }
  28.       }
  29.  
  30.       listenerVector.addElement(var0);
  31.    }
  32.  
  33.    public static synchronized boolean removeZGAppEventListener(ZGAppEventListener var0) {
  34.       new Integer(4);
  35.       new StringBuffer();
  36.       return listenerVector.removeElement(var0);
  37.    }
  38.  
  39.    protected static void appEvent(int var0) {
  40.       new Integer(4);
  41.       new StringBuffer();
  42.       Object var1 = null;
  43.       switch (var0) {
  44.          case 1:
  45.             Enumeration var3 = listenerVector.elements();
  46.  
  47.             while(var3.hasMoreElements()) {
  48.                ((ZGAppEventListener)var3.nextElement()).aboutChosen();
  49.             }
  50.             break;
  51.          case 2:
  52.             Enumeration var2 = listenerVector.elements();
  53.  
  54.             while(var2.hasMoreElements()) {
  55.                ((ZGAppEventListener)var2.nextElement()).quitRequested();
  56.             }
  57.       }
  58.  
  59.    }
  60.  
  61.    protected static void fileEvent(int var0, String var1) {
  62.       new Integer(4);
  63.       new StringBuffer();
  64.       Object var2 = null;
  65.       File var3 = new File(var1);
  66.       switch (var0) {
  67.          case 3:
  68.             Enumeration var5 = listenerVector.elements();
  69.  
  70.             while(var5.hasMoreElements()) {
  71.                ((ZGAppEventListener)var5.nextElement()).requestedOpenFile(var3);
  72.             }
  73.             break;
  74.          case 4:
  75.             Enumeration var4 = listenerVector.elements();
  76.  
  77.             while(var4.hasMoreElements()) {
  78.                ((ZGAppEventListener)var4.nextElement()).requestedPrintFile(var3);
  79.             }
  80.       }
  81.  
  82.    }
  83. }
  84.