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

  1. public class JScriptSelectObject extends JScriptAbstractControlObject {
  2.    private static final int SELECT_ID_LENGTH = 257;
  3.    private static final int SELECT_ID_SELECTEDINDEX = 258;
  4.    private static final int SELECT_ID_OPTIONS = 259;
  5.    private static final int SELECT_ID_FOCUS = 260;
  6.    private static final int SELECT_ID_BLUR = 261;
  7.    private static final int SELECT_ID_ONBLUR = 262;
  8.    private static final int SELECT_ID_ONCHANGE = 263;
  9.    private static final int SELECT_ID_ONFOCUS = 264;
  10.    private static final int SELECT_ID_OPTION = 265;
  11.    private JSbxValue aValuePropVal = new JSbxValue((JSbxBase)null);
  12.  
  13.    public JScriptSelectObject(long var1) {
  14.       super(var1);
  15.  
  16.       try {
  17.          ((JSbxObject)this).Put(new JSbxObjectProperty("options", this, this, 259, false));
  18.          ((JSbxObject)this).Put(new JSbxObjectProperty("selectedIndex", this, this, 258, true));
  19.          ((JSbxObject)this).Put(new JSbxObjectProperty("focus", this, this, 260, true, true));
  20.          ((JSbxObject)this).Put(new JSbxObjectProperty("blur", this, this, 261, true, true));
  21.          ((JSbxObject)this).Put(new JSbxObjectProperty("onblur", this, this, 262, true, true));
  22.          ((JSbxObject)this).Put(new JSbxObjectProperty("onchange", this, this, 263, true, true));
  23.          ((JSbxObject)this).Put(new JSbxObjectProperty("onfocus", this, this, 264, true, true));
  24.       } catch (JSbxException var3) {
  25.       }
  26.    }
  27.  
  28.    public JSbxProperty Get(int var1, boolean var2) {
  29.       Object var3 = (JSbxObjectProperty)((JSbxObject)this).GetIndexArray().Get(var1);
  30.       if (var3 == null && this.getLength() > var1) {
  31.          JScriptOptionObject var4 = new JScriptOptionObject(this, var1);
  32.          var3 = new JSbxOptionObjectProperty(String.valueOf(var1), this, this, 265, var4);
  33.          ((JSbxObject)this).GetIndexArray().Put(var1, var3);
  34.       }
  35.  
  36.       return (JSbxProperty)var3;
  37.    }
  38.  
  39.    public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase {
  40.       int var3 = var1.GetID();
  41.  
  42.       try {
  43.          switch (var3) {
  44.             case 260:
  45.                this.focus();
  46.                break;
  47.             case 261:
  48.                this.blur();
  49.                break;
  50.             default:
  51.                return super.PropertyCallFunction(var1, var2);
  52.          }
  53.       } catch (UnsatisfiedLinkError var5) {
  54.       }
  55.  
  56.       Object var4 = null;
  57.       JSbxValue var6 = new JSbxValue();
  58.       var2.GetRuntimeParam().SetReturnValue(var6);
  59.       return var6;
  60.    }
  61.  
  62.    public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  63.       int var3 = var1.GetID();
  64.  
  65.       try {
  66.          switch (var3) {
  67.             case 66:
  68.                var2.Put(this.aValuePropVal);
  69.                return;
  70.             case 258:
  71.                var2.Put(new JSbxValue((double)this.getSelectedIndex()));
  72.                return;
  73.             case 259:
  74.                var2.Put(new JSbxValue(this));
  75.                return;
  76.             case 262:
  77.                var2.Put(new JSbxValue(this.getOnBlur()));
  78.                return;
  79.             case 263:
  80.                var2.Put(new JSbxValue(this.getOnChange()));
  81.                return;
  82.             case 264:
  83.                var2.Put(new JSbxValue(this.getOnFocus()));
  84.                return;
  85.             case 265:
  86.                JSbxOptionObjectProperty var4 = (JSbxOptionObjectProperty)var1;
  87.                var2.Put(new JSbxValue(var4.getOptionObject()));
  88.                return;
  89.             default:
  90.                super.PropertyGet(var1, var2);
  91.          }
  92.       } catch (UnsatisfiedLinkError var5) {
  93.       }
  94.    }
  95.  
  96.    public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  97.       int var3 = var1.GetID();
  98.  
  99.       try {
  100.          switch (var3) {
  101.             case 66:
  102.                this.aValuePropVal.Put(var2);
  103.                return;
  104.             case 258:
  105.                this.setSelectedIndex((int)var2.GetDouble());
  106.                return;
  107.             case 262:
  108.                this.setOnBlur(var2.GetString());
  109.                return;
  110.             case 263:
  111.                this.setOnChange(var2.GetString());
  112.                return;
  113.             case 264:
  114.                this.setOnFocus(var2.GetString());
  115.                return;
  116.             case 265:
  117.                JSbxOptionObjectProperty var4 = (JSbxOptionObjectProperty)var1;
  118.                JScriptOptionObject var5 = var4.getOptionObject();
  119.                int var6 = var5.getIndex();
  120.                if (var2.GetType() == 2) {
  121.                   JSbxBase var7 = var2.GetObject();
  122.                   if (var7 instanceof JScriptOptionObject) {
  123.                      JScriptOptionObject var8 = (JScriptOptionObject)var7;
  124.                      if (var8.getSelectObject() == null) {
  125.                         var5.SaveConstructorValues(this.getOptionText(var6), this.getOptionValue(var6), this.getOptionDefaultSelected(var6), this.getOptionSelected(var6));
  126.                         var5.setSelectObject((JScriptSelectObject)null);
  127.                         var5.setIndex(0);
  128.                         this.setOption(var6, var8.getOptionText(), var8.getOptionValue(), var8.getDefaultSelected(), var8.getSelected());
  129.                         var8.setSelectObject(this);
  130.                         var8.setIndex(var6);
  131.                         var4.setOptionObject(var8);
  132.                         return;
  133.                      }
  134.                   }
  135.                }
  136.                break;
  137.             default:
  138.                super.PropertyPut(var1, var2);
  139.          }
  140.  
  141.       } catch (UnsatisfiedLinkError var9) {
  142.       }
  143.    }
  144.  
  145.    public String GetJScriptString(boolean var1) {
  146.       return "select";
  147.    }
  148.  
  149.    protected native int getLength();
  150.  
  151.    protected native int getSelectedIndex();
  152.  
  153.    protected native void setSelectedIndex(int var1);
  154.  
  155.    protected native void focus();
  156.  
  157.    protected native void blur();
  158.  
  159.    protected native String getOnBlur();
  160.  
  161.    protected native void setOnBlur(String var1);
  162.  
  163.    protected native String getOnChange();
  164.  
  165.    protected native void setOnChange(String var1);
  166.  
  167.    protected native String getOnFocus();
  168.  
  169.    protected native void setOnFocus(String var1);
  170.  
  171.    protected native void setOption(int var1, String var2, String var3, boolean var4, boolean var5);
  172.  
  173.    protected native boolean getOptionDefaultSelected(int var1);
  174.  
  175.    protected native void setOptionDefaultSelected(boolean var1, int var2);
  176.  
  177.    protected native boolean getOptionSelected(int var1);
  178.  
  179.    protected native void setOptionSelected(boolean var1, int var2);
  180.  
  181.    protected native String getOptionText(int var1);
  182.  
  183.    protected native void setOptionText(String var1, int var2);
  184.  
  185.    protected native void setOptionValue(String var1, int var2);
  186.  
  187.    protected native String getOptionValue(int var1);
  188. }
  189.