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

  1. public class JScriptOptionObject extends JSbxObject implements JSbxPropertyInterface {
  2.    public static final String NAME = "Option";
  3.    private static final int OPTION_ID_DEFAULTSELECTED = 257;
  4.    private static final int OPTION_ID_INDEX = 258;
  5.    private static final int OPTION_ID_SELECTED = 259;
  6.    private static final int OPTION_ID_TEXT = 261;
  7.    private static final int OPTION_ID_VALUE = 262;
  8.    private String aOptionText;
  9.    private String aOptionValue;
  10.    private boolean bDefaultSelected;
  11.    private boolean bSelected;
  12.    private int nIndex;
  13.    private JScriptSelectObject pSelectObject;
  14.    private boolean bFreeObject;
  15.  
  16.    public String getOptionText() {
  17.       return this.aOptionText;
  18.    }
  19.  
  20.    public String getOptionValue() {
  21.       return this.aOptionValue;
  22.    }
  23.  
  24.    public boolean getDefaultSelected() {
  25.       return this.bDefaultSelected;
  26.    }
  27.  
  28.    public boolean getSelected() {
  29.       return this.bSelected;
  30.    }
  31.  
  32.    public int getIndex() {
  33.       return this.nIndex;
  34.    }
  35.  
  36.    public void setIndex(int var1) {
  37.       this.nIndex = var1;
  38.    }
  39.  
  40.    public JScriptSelectObject getSelectObject() {
  41.       return this.pSelectObject;
  42.    }
  43.  
  44.    public void setSelectObject(JScriptSelectObject var1) {
  45.       this.pSelectObject = var1;
  46.    }
  47.  
  48.    public JScriptOptionObject(JScriptConstructor var1) {
  49.       super(var1);
  50.       this.bFreeObject = true;
  51.       this.pSelectObject = null;
  52.       this.CreateProperties();
  53.    }
  54.  
  55.    public JScriptOptionObject(JScriptSelectObject var1, int var2) {
  56.       this.bFreeObject = false;
  57.       this.pSelectObject = var1;
  58.       this.nIndex = var2;
  59.       this.CreateProperties();
  60.    }
  61.  
  62.    private void CreateProperties() {
  63.       try {
  64.          ((JSbxObject)this).Put(new JSbxObjectProperty("defaultSelected", this, this, 257));
  65.          ((JSbxObject)this).Put(new JSbxObjectProperty("index", this, this, 258));
  66.          ((JSbxObject)this).Put(new JSbxObjectProperty("selected", this, this, 259));
  67.          ((JSbxObject)this).Put(new JSbxObjectProperty("text", this, this, 261));
  68.          ((JSbxObject)this).Put(new JSbxObjectProperty("value", this, this, 262));
  69.       } catch (JSbxException var1) {
  70.       }
  71.    }
  72.  
  73.    public JSbxValue PropertyCallFunction(JSbxObjectProperty var1, JScriptCallParam var2) throws JSbxExceptionBase {
  74.       return null;
  75.    }
  76.  
  77.    public void PropertyGet(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  78.       int var3 = var1.GetID();
  79.       if (!this.bFreeObject && this.pSelectObject == null) {
  80.          throw new JSbxException(0, "no such property (ID=" + var3 + ")");
  81.       } else {
  82.          JSbxValue var4 = null;
  83.          boolean var5 = false;
  84.          if (this.pSelectObject == null) {
  85.             switch (var3) {
  86.                case 257:
  87.                   var4 = new JSbxValue(this.bDefaultSelected);
  88.                   break;
  89.                case 258:
  90.                   var4 = new JSbxValue((double)this.nIndex);
  91.                   break;
  92.                case 259:
  93.                   var4 = new JSbxValue(this.bSelected);
  94.                   break;
  95.                case 260:
  96.                default:
  97.                   var5 = true;
  98.                   break;
  99.                case 261:
  100.                   var4 = new JSbxValue(this.aOptionText);
  101.                   break;
  102.                case 262:
  103.                   var4 = new JSbxValue(this.aOptionValue);
  104.             }
  105.          } else {
  106.             try {
  107.                switch (var3) {
  108.                   case 257:
  109.                      var4 = new JSbxValue(this.pSelectObject.getOptionDefaultSelected(this.nIndex));
  110.                      break;
  111.                   case 258:
  112.                      var4 = new JSbxValue((double)this.nIndex);
  113.                      break;
  114.                   case 259:
  115.                      var4 = new JSbxValue(this.pSelectObject.getOptionSelected(this.nIndex));
  116.                      break;
  117.                   case 260:
  118.                   default:
  119.                      var5 = true;
  120.                      break;
  121.                   case 261:
  122.                      var4 = new JSbxValue(this.pSelectObject.getOptionText(this.nIndex));
  123.                      break;
  124.                   case 262:
  125.                      var4 = new JSbxValue(this.pSelectObject.getOptionValue(this.nIndex));
  126.                }
  127.             } catch (UnsatisfiedLinkError var6) {
  128.             }
  129.          }
  130.  
  131.          if (var4 != null) {
  132.             var2.Put(var4);
  133.          } else {
  134.             if (var5) {
  135.                ((JSbxObject)this).GetConstructor().PropertyGet(var1, var2);
  136.             }
  137.  
  138.          }
  139.       }
  140.    }
  141.  
  142.    public void PropertyPut(JSbxObjectProperty var1, JSbxValue var2) throws JSbxException {
  143.       int var3 = var1.GetID();
  144.       if (!this.bFreeObject && this.pSelectObject == null) {
  145.          throw new JSbxException(0, "no such property (ID=" + var3 + ")");
  146.       } else if (this.pSelectObject == null) {
  147.          switch (var3) {
  148.             case 257:
  149.                this.bDefaultSelected = var2.GetBool();
  150.                return;
  151.             case 258:
  152.             case 260:
  153.             default:
  154.                ((JSbxObject)this).GetConstructor().PropertyPut(var1, var2);
  155.                return;
  156.             case 259:
  157.                this.bSelected = var2.GetBool();
  158.                return;
  159.             case 261:
  160.                this.aOptionText = var2.GetString();
  161.                return;
  162.             case 262:
  163.                this.aOptionValue = var2.GetString();
  164.          }
  165.       } else {
  166.          try {
  167.             switch (var3) {
  168.                case 257:
  169.                   this.pSelectObject.setOptionDefaultSelected(var2.GetBool(), this.nIndex);
  170.                   return;
  171.                case 258:
  172.                case 260:
  173.                default:
  174.                   ((JSbxObject)this).GetConstructor().PropertyPut(var1, var2);
  175.                   return;
  176.                case 259:
  177.                   this.pSelectObject.setOptionSelected(var2.GetBool(), this.nIndex);
  178.                   return;
  179.                case 261:
  180.                   this.pSelectObject.setOptionText(var2.GetString(), this.nIndex);
  181.                   return;
  182.                case 262:
  183.                   this.pSelectObject.setOptionValue(var2.GetString(), this.nIndex);
  184.             }
  185.          } catch (UnsatisfiedLinkError var4) {
  186.          }
  187.       }
  188.    }
  189.  
  190.    public String Property_GetJScript_typeofString(JSbxObjectProperty var1) {
  191.       return "option";
  192.    }
  193.  
  194.    public String GetJScriptString(boolean var1) {
  195.       return "option";
  196.    }
  197.  
  198.    public final void SaveConstructorValues(String var1, String var2, boolean var3, boolean var4) {
  199.       this.aOptionText = var1;
  200.       this.aOptionValue = var2;
  201.       this.bDefaultSelected = var3;
  202.       this.bSelected = var4;
  203.    }
  204.  
  205.    protected native String getValue();
  206. }
  207.