Inheritance diagram for SaObjectChoice::
Public Methods | |
SaObjectChoice (String choiceType) | |
void | relist () |
void | relist (String choiceType) |
Object | getSelectedVal () |
Return the selected value as a proper Java Object instead of just a string. More... |
|
00025 { 00026 super(); 00027 setEditable(true); 00028 relist(choiceType); 00029 } |
|
00033 { 00034 removeAllItems(); 00035 relist(_choiceType); 00036 } |
|
Reimplemented in StubObjectChoice, and RgbObjectChoice.
00040 { 00041 _choiceType = choiceType; 00042 if ((_choiceType.compareTo("") == 0) 00043 || (_choiceType.compareTo("<empty>") == 0)) { 00044 addItem("<empty>"); 00045 return; 00046 } 00047 00048 int i; 00049 if (_choiceType.equals("boolean") || _choiceType.equals("Boolean") 00050 || _choiceType.equals("java.lang.Boolean")) { 00051 for (i=0 ; i<_bools.length ; i++) 00052 addItem(_bools[i]); 00053 return; 00054 } 00055 00056 if (_choiceType.equals("byte") || _choiceType.equals("Byte") 00057 || _choiceType.equals("java.lang.Byte") 00058 || _choiceType.equals("short") || _choiceType.equals("Short") 00059 || _choiceType.equals("java.lang.Short") 00060 || _choiceType.equals("int") || _choiceType.equals("Integer") 00061 || _choiceType.equals("java.lang.Integer")) { 00062 addItem("0"); 00063 addItem("1"); 00064 addItem("256"); 00065 return; 00066 } 00067 00068 if (_choiceType.equals("float") || _choiceType.equals("Float") 00069 || _choiceType.equals("java.lang.Float") 00070 || _choiceType.equals("double") || _choiceType.equals("Double") 00071 || _choiceType.equals("java.lang.Double")) { 00072 addItem("0.0"); 00073 addItem("1.0"); 00074 return; 00075 } 00076 00077 if (_choiceType.equals("Color") || _choiceType.equals("java.awt.Color")) { 00078 for (i=0 ; i<_colors.length ; i++) 00079 addItem(_colors[i]); 00080 return; 00081 } 00082 00083 if (_choiceType.equals("ViewerMode")) { 00084 for (i=0 ; i<ViewerMode.viewerModes.length ; i++) 00085 addItem(ViewerMode.viewerModes[i]); 00086 return; 00087 } 00088 00089 if (_choiceType.equals("ViewerSubMode")) { 00090 String[] subModes = ViewerMode.viewerSubModes(); 00091 for (i=0 ; i<subModes.length ; i++) 00092 addItem(subModes[i]); 00093 return; 00094 } 00095 00096 // assume it is stored in the registry 00097 00098 String [] names; 00099 try { 00100 if (_mediator == null) 00101 _mediator = new HxMediatorPeer(); 00102 names = _mediator.getSaObjectNames(_choiceType); 00103 } 00104 catch(UnsatisfiedLinkError ex) { 00105 // Library not loaded 00106 names = new String[0]; 00107 } 00108 00109 int num = names.length; 00110 if (num == 0) 00111 addItem("<empty>"); 00112 else { 00113 for (i=0 ; i<num ; i++) { 00114 addItem(names[i]); 00115 } 00116 } 00117 } |
|
Return the selected value as a proper Java Object instead of just a string.
Reimplemented in StubObjectChoice, and RgbObjectChoice.
00123 { 00124 String val = (String) getSelectedItem(); 00125 00126 if (_choiceType.equals("boolean") || _choiceType.equals("Boolean") 00127 || _choiceType.equals("java.lang.Boolean")) { 00128 return getBoolean(val); 00129 } 00130 if (_choiceType.equals("byte") || _choiceType.equals("Byte") 00131 || _choiceType.equals("java.lang.Byte")) { 00132 return getByte(val); 00133 } 00134 if (_choiceType.equals("short") || _choiceType.equals("Short") 00135 || _choiceType.equals("java.lang.Short")) { 00136 return getShort(val); 00137 } 00138 if (_choiceType.equals("int") || _choiceType.equals("Integer") 00139 || _choiceType.equals("java.lang.Integer")) { 00140 return getInteger(val); 00141 } 00142 if (_choiceType.equals("float") || _choiceType.equals("Float") 00143 || _choiceType.equals("java.lang.Float")) { 00144 return getFloat(val); 00145 } 00146 if (_choiceType.equals("double") || _choiceType.equals("Double") 00147 || _choiceType.equals("java.lang.Double")) { 00148 return getDouble(val); 00149 } 00150 if (_choiceType.equals("Color") || _choiceType.equals("java.awt.Color")) { 00151 return getColor(val); 00152 } 00153 if (_choiceType.equals("ViewerMode")) { 00154 return getViewerMode(val); 00155 } 00156 if (_choiceType.equals("ViewerSubMode")) { 00157 return getViewerSubMode(val); 00158 } 00159 if (_choiceType.equals("HxGeoIntType")) { 00160 return getHxGeoIntType(val); 00161 } 00162 00163 return val; 00164 } |