Inheritance diagram for EnumChoice::
Public Methods | |
EnumChoice (TypeCode tc) | |
String | name () |
Name of the type. More... | |
JComponent | inputArg () |
Dialog component where the user specifies the result. More... | |
JComponent | inputRes () |
Dialog component where the user specifies the parameter. More... | |
String | getResult (Any resAny) |
Request management: extract result from Any (and convert it to String). More... | |
void | setArgument (Any argsAny) throws InvalidChoiceException |
Request management: add argument to Any. More... | |
String | toString (java.lang.Object obj) |
Converts that object to string. More... | |
java.lang.Object | asObject (String inText) throws InvalidChoiceException |
Returns the object introduced as that text. More... | |
java.lang.Object | asObject () throws InvalidChoiceException |
Returns the object selected in that choice. More... |
|
00028 { 00029 super(tc); 00030 try { 00031 _name = tc.name(); 00032 _values = new String[tc.member_count()]; 00033 for(int i=0; i<_values.length; i++) 00034 _values[i] = tc.member_name(i); 00035 00036 }catch(Exception e){ 00037 } 00038 } |
|
Name of the type.
Reimplemented from CorbaObjectChoice.
00041 { 00042 return "enum "+_name; 00043 } |
|
Dialog component where the user specifies the result.
Reimplemented from CorbaObjectChoice.
00046 { 00047 if(_input == null) { 00048 _input = new JComboBox(_values); 00049 } 00050 return _input; 00051 } |
|
Dialog component where the user specifies the parameter.
Reimplemented from CorbaObjectChoice.
00054 { 00055 return null; 00056 } |
|
Request management: extract result from Any (and convert it to String).
Reimplemented from CorbaObjectChoice.
00059 { 00060 String resName = null; 00061 try { 00062 //result = HxCorba."name"Helper.extract(resAny); 00063 00064 Class helper = Class.forName("HxCorba."+_name+"Helper"); 00065 Class[] argTypes = { Any.class }; 00066 Method methExt = helper.getMethod("extract", argTypes); 00067 java.lang.Object[] args = { resAny }; 00068 java.lang.Object obj = methExt.invoke(null, args); 00069 00070 resName = toString(obj); 00071 00072 }catch(Exception e) { 00073 ErrorStreamArea.println(e+": Cannot find helper class for "+_name); 00074 } 00075 00076 return resName; 00077 } |
|
Request management: add argument to Any.
Reimplemented from CorbaObjectChoice.
00080 { 00081 java.lang.Object obj = asObject(); 00082 00083 try { 00084 //HxCorba."name"Helper.insert(argsAny, this); 00085 00086 Class helper = Class.forName("HxCorba."+_name+"Helper"); 00087 Class[] argTypes = { Any.class, Class.forName("HxCorba."+_name) }; 00088 Method methIns = helper.getMethod("insert", argTypes); 00089 java.lang.Object[] args = { argsAny, obj }; 00090 methIns.invoke(null, args); 00091 }catch(Exception e) { 00092 ErrorStreamArea.println(e+": Cannot find helper class for "+_name); 00093 } 00094 } |
|
Converts that object to string. Useful method to implement getResult. Reimplemented from CorbaObjectChoice.
00097 { 00098 try { 00099 //v = obj.value(); 00100 00101 Class enumC = Class.forName("HxCorba."+_name); 00102 Class[] argTypes = { }; 00103 Method meth = enumC.getMethod("value", argTypes); 00104 java.lang.Object[] args = { }; 00105 Integer v = (Integer)meth.invoke(obj, args); 00106 return _values[v.intValue()]; 00107 }catch(Exception e) { 00108 ErrorStreamArea.println(e+": Cannot find HxCorba."+_name+".class"); 00109 } 00110 00111 return "unknown"; 00112 } |
|
Returns the object introduced as that text. Useful method to implement setArgument. Reimplemented from CorbaObjectChoice.
00116 { 00117 return null; // never gets called 00118 } |
|
Returns the object selected in that choice. Useful method to implement setArgument. Reimplemented from CorbaObjectChoice.
00121 { 00122 int index = _input.getSelectedIndex(); 00123 java.lang.Object result = null; 00124 00125 try { 00126 //result = HxCorba."name".from_int(index); 00127 00128 Class enumC = Class.forName("HxCorba."+_name); 00129 Class[] argTypes = { int.class }; 00130 Method meth = enumC.getMethod("from_int", argTypes); 00131 java.lang.Object[] args = { new Integer(index) }; 00132 result = meth.invoke(null, args); 00133 }catch(Exception e) { 00134 ErrorStreamArea.println(e.toString()); 00135 } 00136 00137 return result; 00138 } |