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

  1. public class JScriptDocumentObject extends JSbxObject implements JSbxPropertyInterface {
  2.    private static final String NAME = "document";
  3.    private static final int DOCUMENT_ID_ALINKCOLOR = 1;
  4.    private static final int DOCUMENT_ID_LINKCOLOR = 2;
  5.    private static final int DOCUMENT_ID_BGCOLOR = 3;
  6.    private static final int DOCUMENT_ID_FGCOLOR = 4;
  7.    private static final int DOCUMENT_ID_VLINKCOLOR = 5;
  8.    private static final int DOCUMENT_ID_COOKIE = 6;
  9.    private static final int DOCUMENT_ID_LASTMODIFIED = 7;
  10.    private static final int DOCUMENT_ID_REFERRER = 8;
  11.    private static final int DOCUMENT_ID_TITLE = 9;
  12.    private static final int DOCUMENT_ID_URL = 10;
  13.    private static final int DOCUMENT_ID_LOCATION = 11;
  14.    private static final int DOCUMENT_ID_DOMAIN = 12;
  15.    private static final int DOCUMENT_ID_ANCHORS = 17;
  16.    private static final int DOCUMENT_ID_FORMS = 18;
  17.    private static final int DOCUMENT_ID_LINKS = 19;
  18.    private static final int DOCUMENT_ID_IMAGES = 33;
  19.    private static final int DOCUMENT_ID_EMBEDS = 34;
  20.    private static final int DOCUMENT_ID_APPLETS = 35;
  21.    private static final int DOCUMENT_ID_CLEAR = 49;
  22.    private static final int DOCUMENT_ID_CLOSE = 50;
  23.    private static final int DOCUMENT_ID_OPEN = 51;
  24.    private static final int DOCUMENT_ID_WRITE = 52;
  25.    private static final int DOCUMENT_ID_WRITELN = 53;
  26.  
  27.    public JScriptDocumentObject(long var1) {
  28.       super(var1, JScriptManager.GetConstructorObjectForMe("DefaultConstructor"));
  29.  
  30.       try {
  31.          ((JSbxObject)this).Put(new JSbxObjectProperty("forms", this, this, 18, true));
  32.          ((JSbxObject)this).Put(new JSbxObjectProperty("links", this, this, 19, true));
  33.          ((JSbxObject)this).Put(new JSbxObjectProperty("anchors", this, this, 17, true));
  34.          ((JSbxObject)this).Put(new JSbxObjectProperty("applets", this, this, 35, true));
  35.          ((JSbxObject)this).Put(new JSbxObjectProperty("embeds", this, this, 34, true));
  36.          ((JSbxObject)this).Put(new JSbxObjectProperty("images", this, this, 33, true));
  37.          ((JSbxObject)this).Put(new JSbxObjectProperty("title", this, this, 9, true));
  38.          ((JSbxObject)this).Put(new JSbxObjectProperty("URL", this, this, 10, true));
  39.          ((JSbxObject)this).Put(new JSbxObjectProperty("referrer", this, this, 8, true));
  40.          ((JSbxObject)this).Put(new JSbxObjectProperty("lastModified", this, this, 7, true));
  41.          ((JSbxObject)this).Put(new JSbxObjectProperty("cookie", this, this, 6, true));
  42.          ((JSbxObject)this).Put(new JSbxObjectProperty("domain", this, this, 12, true));
  43.          ((JSbxObject)this).Put(new JSbxObjectProperty("bgColor", this, this, 3, true));
  44.          ((JSbxObject)this).Put(new JSbxObjectProperty("fgColor", this, this, 4, true));
  45.          ((JSbxObject)this).Put(new JSbxObjectProperty("linkColor", this, this, 2, true));
  46.          ((JSbxObject)this).Put(new JSbxObjectProperty("vlinkColor", this, this, 5, true));
  47.          ((JSbxObject)this).Put(new JSbxObjectProperty("alinkColor", this, this, 1, true));
  48.          ((JSbxObject)this).Put(new JSbxObjectProperty("location", this, this, 11, true, true));
  49.          ((JSbxObject)this).Put(new JSbxObjectProperty("clear", this, this, 49, true, true));
  50.          ((JSbxObject)this).Put(new JSbxObjectProperty("close", this, this, 50, true, true));
  51.          ((JSbxObject)this).Put(new JSbxObjectProperty("open", this, this, 51, true, true));
  52.          ((JSbxObject)this).Put(new JSbxObjectProperty("write", this, this, 52, true, true));
  53.          ((JSbxObject)this).Put(new JSbxObjectProperty("writeln", this, this, 53, true, true));
  54.       } catch (JSbxException var3) {
  55.       }
  56.    }
  57.  
  58.    public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase {
  59.       JSbxVector var3 = var2.GetParamVector();
  60.       int var4 = var3 != null ? var3.GetSize() : 0;
  61.       int var5 = var1.GetID();
  62.       String var6 = "";
  63.       double var7 = (double)0.0F;
  64.       boolean var9 = false;
  65.       boolean var10 = true;
  66.  
  67.       try {
  68.          switch (var5) {
  69.             case 49:
  70.                this.clear();
  71.                break;
  72.             case 50:
  73.                this.close();
  74.                break;
  75.             case 51:
  76.                if (var4 > 0) {
  77.                   return new JSbxValue(this.open(JScriptWindowObject.GetStringParam(var3, 0)));
  78.                }
  79.                break;
  80.             case 52:
  81.                String var14 = "";
  82.  
  83.                for(int var17 = 0; var17 < var4; ++var17) {
  84.                   var14 = var14 + JScriptWindowObject.GetStringParam(var3, var17);
  85.                }
  86.  
  87.                this.write(var14);
  88.                break;
  89.             case 53:
  90.                String var11 = "";
  91.  
  92.                for(int var12 = 0; var12 < var4; ++var12) {
  93.                   var11 = var11 + JScriptWindowObject.GetStringParam(var3, var12);
  94.                }
  95.  
  96.                this.writeln(var11);
  97.                break;
  98.             default:
  99.                throw new JSbxException(0, "no such method in document (ID=" + var5 + ")");
  100.          }
  101.       } catch (UnsatisfiedLinkError var13) {
  102.       }
  103.  
  104.       Object var15 = null;
  105.       JSbxValue var16;
  106.       if (var10) {
  107.          var16 = new JSbxValue();
  108.       } else if (var9) {
  109.          var16 = new JSbxValue(var7);
  110.       } else {
  111.          var16 = new JSbxValue(var6);
  112.       }
  113.  
  114.       var2.GetRuntimeParam().SetReturnValue(var16);
  115.       return var16;
  116.    }
  117.  
  118.    public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  119.       int var3 = var1.GetID();
  120.  
  121.       try {
  122.          switch (var3) {
  123.             case 1:
  124.                var2.Put(new JSbxValue(this.getaLinkColor()));
  125.                return;
  126.             case 2:
  127.                var2.Put(new JSbxValue(this.getLinkColor()));
  128.                return;
  129.             case 3:
  130.                var2.Put(new JSbxValue(this.getBgColor()));
  131.                return;
  132.             case 4:
  133.                var2.Put(new JSbxValue(this.getFgColor()));
  134.                return;
  135.             case 5:
  136.                var2.Put(new JSbxValue(this.getvLinkColor()));
  137.                return;
  138.             case 6:
  139.                var2.Put(new JSbxValue(this.getCookie()));
  140.                return;
  141.             case 7:
  142.                var2.Put(new JSbxValue(this.getLastModified()));
  143.                return;
  144.             case 8:
  145.                var2.Put(new JSbxValue(this.getReferrer()));
  146.                return;
  147.             case 9:
  148.                var2.Put(new JSbxValue(this.getTitle()));
  149.                return;
  150.             case 10:
  151.                var2.Put(new JSbxValue(this.getURL()));
  152.                return;
  153.             case 11:
  154.                var2.Put(new JSbxValue(this.getLocation()));
  155.                return;
  156.             case 12:
  157.                var2.Put(new JSbxValue(this.getDomain()));
  158.                return;
  159.             case 17:
  160.                JSbxArrayObject var10 = this.getAnchors();
  161.                if (var10 != null) {
  162.                   var10.SetArrayType("AnchorArray");
  163.                }
  164.  
  165.                var2.Put(new JSbxValue(var10));
  166.                return;
  167.             case 18:
  168.                JSbxArrayObject var9 = this.getForms();
  169.                if (var9 != null) {
  170.                   var9.SetArrayType("FormsArray");
  171.                }
  172.  
  173.                var2.Put(new JSbxValue(var9));
  174.                return;
  175.             case 19:
  176.                JSbxArrayObject var8 = this.getLinks();
  177.                if (var8 != null) {
  178.                   var8.SetArrayType("LinkArray");
  179.                }
  180.  
  181.                var2.Put(new JSbxValue(var8));
  182.                return;
  183.             case 33:
  184.                JSbxArrayObject var7 = this.getImages();
  185.                if (var7 != null) {
  186.                   var7.SetArrayType("ImageArray");
  187.                }
  188.  
  189.                var2.Put(new JSbxValue(var7));
  190.                return;
  191.             case 34:
  192.                JSbxArrayObject var6 = this.getEmbeds();
  193.                if (var6 != null) {
  194.                   var6.SetArrayType("EmbedArray");
  195.                }
  196.  
  197.                var2.Put(new JSbxValue(var6));
  198.                return;
  199.             case 35:
  200.                JSbxArrayObject var4 = this.getApplets();
  201.                if (var4 != null) {
  202.                   var4.SetArrayType("AppletArray");
  203.                }
  204.  
  205.                var2.Put(new JSbxValue(var4));
  206.                return;
  207.             default:
  208.                throw new JSbxException(0, "no such property in document (ID=" + var3 + ")");
  209.          }
  210.       } catch (UnsatisfiedLinkError var5) {
  211.       }
  212.    }
  213.  
  214.    public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  215.       int var3 = var1.GetID();
  216.  
  217.       try {
  218.          switch (var3) {
  219.             case 1:
  220.                this.setaLinkColor(var2.GetString());
  221.                return;
  222.             case 2:
  223.                this.setLinkColor(var2.GetString());
  224.                return;
  225.             case 3:
  226.                this.setBgColor(var2.GetString());
  227.                return;
  228.             case 4:
  229.                this.setFgColor(var2.GetString());
  230.                return;
  231.             case 5:
  232.                this.setvLinkColor(var2.GetString());
  233.                return;
  234.             case 6:
  235.                this.setCookie(var2.GetString());
  236.                return;
  237.             case 7:
  238.             case 8:
  239.             case 10:
  240.             default:
  241.                throw new JSbxException(0, "no such property in document (ID=" + var3 + ")");
  242.             case 9:
  243.                break;
  244.             case 11:
  245.                JScriptLocationObject var4 = this.getLocation();
  246.                if (var4 != null) {
  247.                   var4.SetHref(var2.GetString());
  248.                   return;
  249.                }
  250.          }
  251.       } catch (UnsatisfiedLinkError var5) {
  252.       }
  253.  
  254.    }
  255.  
  256.    public String Property_GetJScript_typeofString(JSbxObjectProperty var1) {
  257.       return "document";
  258.    }
  259.  
  260.    public String GetJScriptString(boolean var1) {
  261.       return " ";
  262.    }
  263.  
  264.    private native String getaLinkColor();
  265.  
  266.    private native void setaLinkColor(String var1);
  267.  
  268.    private native String getLinkColor();
  269.  
  270.    private native void setLinkColor(String var1);
  271.  
  272.    private native String getBgColor();
  273.  
  274.    private native void setBgColor(String var1);
  275.  
  276.    private native String getFgColor();
  277.  
  278.    private native void setFgColor(String var1);
  279.  
  280.    private native String getvLinkColor();
  281.  
  282.    private native void setvLinkColor(String var1);
  283.  
  284.    private native JSbxArrayObject getAnchors();
  285.  
  286.    private native JSbxArrayObject getForms();
  287.  
  288.    private native JSbxArrayObject getLinks();
  289.  
  290.    private native JSbxArrayObject getApplets();
  291.  
  292.    private native JSbxArrayObject getImages();
  293.  
  294.    private native JSbxArrayObject getEmbeds();
  295.  
  296.    private native String getCookie();
  297.  
  298.    private native void setCookie(String var1);
  299.  
  300.    private native String getLastModified();
  301.  
  302.    private native String getReferrer();
  303.  
  304.    private native String getTitle();
  305.  
  306.    private native String getURL();
  307.  
  308.    private native JScriptLocationObject getLocation();
  309.  
  310.    private native String getDomain();
  311.  
  312.    private native void clear();
  313.  
  314.    private native void close();
  315.  
  316.    private native JSbxObject open(String var1);
  317.  
  318.    private native void write(String var1);
  319.  
  320.    private native void writeln(String var1);
  321. }
  322.