Inheritance diagram for PointChoice::
Public Methods | |
PointChoice (org.omg.CORBA.TypeCode tc) | |
JComponent | inputArg () |
Dialog component where the user specifies the result. More... | |
java.lang.Object | asObject (String inText) throws InvalidChoiceException |
Returns the object introduced as that text. More... |
|
00023 { 00024 super(tc); 00025 } |
|
Dialog component where the user specifies the result.
Reimplemented from StructChoice.
00028 { 00029 if(_input == null) { 00030 _input = (JComboBox)super.inputArg(); 00031 _input.addItem("1 1"); 00032 _input.addItem("1.0 1.0"); 00033 _input.addItem("255 255"); 00034 00035 _input.setEditable(true); 00036 _input.getEditor().getEditorComponent().addFocusListener(new HxJava.Util.SelectOnFocus()); 00037 _input.setSelectedIndex(0); 00038 } 00039 return _input; 00040 } |
|
Returns the object introduced as that text. Useful method to implement setArgument. Reimplemented from StructChoice.
00043 { 00044 int index = inText.indexOf(" "); 00045 if(index == -1) return super.asObject(inText); 00046 00047 HxCorba.Point res = null; 00048 try { 00049 HxCorba.PixValue val = PixValueChoice.getPixValue(inText); 00050 if(val.discriminator() == HxCorba.PixValueTag.V2I) { 00051 HxCorba.Vec2I val2I = val.vect2Int(); 00052 res = new HxCorba.Point(val2I.x, val2I.y, 0); 00053 } 00054 else if(val.discriminator() == HxCorba.PixValueTag.V2D) { 00055 HxCorba.Vec2D val2D = val.vect2Double(); 00056 res = new HxCorba.Point(val2D.x, val2D.y, 0); 00057 } 00058 } 00059 catch(InvalidChoiceException ex) {} 00060 00061 if(res == null) { 00062 _input.requestFocus(); 00063 throw new InvalidChoiceException("Wrong point"); 00064 } 00065 00066 return res; 00067 } |