home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptImageObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  4.6 KB  |  223 lines

  1. import stardiv.tools.HoldJavaEnvironment;
  2.  
  3. public class JScriptImageObject extends JSbxObject implements JSbxPropertyInterface {
  4.    public static final String NAME = "Image";
  5.    private static final int IMAGE_ID_BORDER = 1;
  6.    private static final int IMAGE_ID_COMPLETE = 2;
  7.    private static final int IMAGE_ID_HEIGHT = 3;
  8.    private static final int IMAGE_ID_HSPACE = 4;
  9.    private static final int IMAGE_ID_LOWSRC = 5;
  10.    private static final int IMAGE_ID_NAME = 6;
  11.    private static final int IMAGE_ID_PROTOTYPE = 7;
  12.    private static final int IMAGE_ID_SRC = 8;
  13.    private static final int IMAGE_ID_VSPACE = 9;
  14.    private static final int IMAGE_ID_WIDTH = 10;
  15.    private static final int IMAGE_ID_ONABORT = 11;
  16.    private static final int IMAGE_ID_ONERROR = 12;
  17.    private static final int IMAGE_ID_ONLOAD = 13;
  18.    private int nHeight;
  19.    private int nWidth;
  20.    private String aSrcStrg;
  21.  
  22.    public final void SetHeight(int var1) {
  23.       this.nHeight = var1;
  24.    }
  25.  
  26.    public final void SetWidth(int var1) {
  27.       this.nWidth = var1;
  28.    }
  29.  
  30.    public final void SetSrcStrg(String var1) {
  31.       this.aSrcStrg = var1;
  32.    }
  33.  
  34.    public JScriptImageObject(JScriptConstructor var1) {
  35.       this(0L, var1);
  36.    }
  37.  
  38.    public JScriptImageObject(long var1) {
  39.       this(var1, JScriptManager.GetConstructorObjectForMe("DefaultConstructor"));
  40.    }
  41.  
  42.    private JScriptImageObject(long var1, JScriptConstructor var3) {
  43.       super(var1, var3);
  44.       this.SetWidth(0);
  45.       this.SetHeight(0);
  46.  
  47.       try {
  48.          ((JSbxObject)this).Put(new JSbxObjectProperty("border", this, this, 1, true));
  49.          ((JSbxObject)this).Put(new JSbxObjectProperty("complete", this, this, 2, true));
  50.          ((JSbxObject)this).Put(new JSbxObjectProperty("height", this, this, 3, false));
  51.          ((JSbxObject)this).Put(new JSbxObjectProperty("hspace", this, this, 4, true));
  52.          ((JSbxObject)this).Put(new JSbxObjectProperty("lowsrc", this, this, 5, true));
  53.          ((JSbxObject)this).Put(new JSbxObjectProperty("name", this, this, 6, true));
  54.          ((JSbxObject)this).Put(new JSbxObjectProperty("src", this, this, 8, false));
  55.          ((JSbxObject)this).Put(new JSbxObjectProperty("vspace", this, this, 9, true));
  56.          ((JSbxObject)this).Put(new JSbxObjectProperty("width", this, this, 10, false));
  57.          ((JSbxObject)this).Put(new JSbxObjectProperty("onabort", this, this, 11, true));
  58.          ((JSbxObject)this).Put(new JSbxObjectProperty("onerror", this, this, 12, true));
  59.          ((JSbxObject)this).Put(new JSbxObjectProperty("onload", this, this, 13, true));
  60.       } catch (JSbxException var4) {
  61.       }
  62.  
  63.       this.nWidth = 0;
  64.       this.nHeight = 0;
  65.       this.aSrcStrg = null;
  66.    }
  67.  
  68.    public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase {
  69.       throw new JSbxException(0, "no such method in Image");
  70.    }
  71.  
  72.    public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  73.       int var3 = var1.GetID();
  74.  
  75.       try {
  76.          switch (var3) {
  77.             case 1:
  78.                var2.Put(new JSbxValue(this.getBorder()));
  79.                return;
  80.             case 2:
  81.                var2.Put(new JSbxValue(this.getComplete()));
  82.                return;
  83.             case 3:
  84.                if (((JSbxObject)this).ExistsNativeHandle()) {
  85.                   if (HoldJavaEnvironment.CanIAskApplication()) {
  86.                      var2.Put(new JSbxValue(this.getHeight()));
  87.                      return;
  88.                   }
  89.                } else {
  90.                   var2.Put(new JSbxValue((double)this.nHeight));
  91.                }
  92.  
  93.                return;
  94.             case 4:
  95.                var2.Put(new JSbxValue(this.getHspace()));
  96.                return;
  97.             case 5:
  98.                var2.Put(new JSbxValue(this.getLowsrc()));
  99.                return;
  100.             case 6:
  101.                var2.Put(new JSbxValue(this.getName()));
  102.                return;
  103.             case 7:
  104.             default:
  105.                throw new JSbxException(0, "no such property in Image (ID=" + var3 + ")");
  106.             case 8:
  107.                if (((JSbxObject)this).ExistsNativeHandle()) {
  108.                   if (HoldJavaEnvironment.CanIAskApplication()) {
  109.                      var2.Put(new JSbxValue(this.getSrc()));
  110.                      return;
  111.                   }
  112.                } else {
  113.                   var2.Put(new JSbxValue(this.aSrcStrg != null ? this.aSrcStrg : ""));
  114.                }
  115.  
  116.                return;
  117.             case 9:
  118.                var2.Put(new JSbxValue(this.getVspace()));
  119.                return;
  120.             case 10:
  121.                if (((JSbxObject)this).ExistsNativeHandle()) {
  122.                   if (HoldJavaEnvironment.CanIAskApplication()) {
  123.                      var2.Put(new JSbxValue(this.getWidth()));
  124.                      return;
  125.                   }
  126.                } else {
  127.                   var2.Put(new JSbxValue((double)this.nWidth));
  128.                }
  129.  
  130.                return;
  131.             case 11:
  132.                var2.Put(new JSbxValue(this.getOnAbort()));
  133.                return;
  134.             case 12:
  135.                var2.Put(new JSbxValue(this.getOnError()));
  136.                return;
  137.             case 13:
  138.                var2.Put(new JSbxValue(this.getOnLoad()));
  139.          }
  140.       } catch (UnsatisfiedLinkError var4) {
  141.       }
  142.    }
  143.  
  144.    public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  145.       int var3 = var1.GetID();
  146.  
  147.       try {
  148.          switch (var3) {
  149.             case 5:
  150.                this.setLowsrc(var2.GetString());
  151.                return;
  152.             case 8:
  153.                if (((JSbxObject)this).ExistsNativeHandle()) {
  154.                   if (HoldJavaEnvironment.CanIAskApplication()) {
  155.                      this.setSrc(var2.GetString());
  156.                      return;
  157.                   }
  158.                } else {
  159.                   this.aSrcStrg = var2.GetString();
  160.                }
  161.  
  162.                return;
  163.             case 11:
  164.                this.setOnAbort(var2.GetString());
  165.                return;
  166.             case 12:
  167.                this.setOnError(var2.GetString());
  168.                return;
  169.             case 13:
  170.                this.setOnLoad(var2.GetString());
  171.                return;
  172.             default:
  173.                throw new JSbxException(0, "no such property in Image (ID=" + var3 + ")");
  174.          }
  175.       } catch (UnsatisfiedLinkError var4) {
  176.       }
  177.    }
  178.  
  179.    public String Property_GetJScript_typeofString(JSbxObjectProperty var1) {
  180.       return "Image";
  181.    }
  182.  
  183.    public String GetJScriptString(boolean var1) {
  184.       return "[object Image]";
  185.    }
  186.  
  187.    private native String getBorder();
  188.  
  189.    private native boolean getComplete();
  190.  
  191.    private native String getHeight();
  192.  
  193.    private native String getHspace();
  194.  
  195.    private native String getLowsrc();
  196.  
  197.    private native void setLowsrc(String var1);
  198.  
  199.    private native String getName();
  200.  
  201.    private native String getPrototype();
  202.  
  203.    private native String getSrc();
  204.  
  205.    private native void setSrc(String var1);
  206.  
  207.    private native String getVspace();
  208.  
  209.    private native String getWidth();
  210.  
  211.    protected native String getOnAbort();
  212.  
  213.    protected native void setOnAbort(String var1);
  214.  
  215.    protected native String getOnError();
  216.  
  217.    protected native void setOnError(String var1);
  218.  
  219.    protected native String getOnLoad();
  220.  
  221.    protected native void setOnLoad(String var1);
  222. }
  223.