Inheritance diagram for PixValueChoice::

Public Methods | |
| PixValueChoice (TypeCode tc) | |
| String | name () |
| Name of the type. More... | |
| JComponent | inputRes () |
| Dialog component where the user specifies the parameter. More... | |
| JComponent | inputArg () |
| Dialog component where the user specifies the result. 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... | |
| java.lang.Object | asObject (String name) throws InvalidChoiceException |
| Returns the object introduced as that text. More... | |
| String | toString (java.lang.Object obj) |
| Converts that object to string. More... | |
Static Public Methods | |
| HxCorba.PixValue | getPixValue (String strValue) throws InvalidChoiceException |
|
|
00023 {
00024 super(tc);
00025 }
|
|
|
Name of the type.
Reimplemented from CorbaObjectChoice.
00028 {
00029 return "PixValue";
00030 }
|
|
|
Dialog component where the user specifies the parameter.
Reimplemented from CorbaObjectChoice.
00033 {
00034 return null;
00035 }
|
|
|
Dialog component where the user specifies the result.
Reimplemented from CorbaObjectChoice.
00038 {
00039 if(_input == null) {
00040 _input = new JComboBox();
00041 _input.addItem("1");
00042 _input.addItem("1.0");
00043 _input.addItem("1 1");
00044 _input.addItem("1.0 1.0");
00045 _input.addItem("1 1 1");
00046 _input.addItem("1.0 1.0 1.0");
00047
00048 _input.setEditable(true);
00049 _input.getEditor().getEditorComponent().addFocusListener(new HxJava.Util.SelectOnFocus());
00050
00051 _input.setSelectedIndex(0);
00052 }
00053 return _input;
00054 }
|
|
|
Request management: extract result from Any (and convert it to String).
Reimplemented from CorbaObjectChoice.
00058 {
00059 java.lang.Object result = HxCorba.PixValueHelper.extract(resAny);
00060 return toString(result);
00061 }
|
|
|
Request management: add argument to Any.
Reimplemented from CorbaObjectChoice.
00064 {
00065 HxCorba.PixValue val = (HxCorba.PixValue)asObject();
00066 HxCorba.PixValueHelper.insert(argsAny, val);
00067 }
|
|
|
00071 {
00072 HxCorba.PixValue val = new HxCorba.PixValue();
00073
00074 try {
00075 int[] values = getIntValues(strValue);
00076 if(values.length > 3)
00077 throw new InvalidChoiceException("Wrong pixel value (too many components)");
00078
00079 switch (values.length) {
00080 case 1:
00081 val.scalarInt(values[0]);
00082 return val;
00083 case 2:
00084 val.vect2Int(new HxCorba.Vec2I(values[0], values[1]));
00085 return val;
00086 case 3:
00087 val.vect3Int(new HxCorba.Vec3I(values[0], values[1], values[2]));
00088 return val;
00089 }
00090 }catch(NumberFormatException e) {
00091 //Maybe are doubles
00092 }
00093
00094 try {
00095 double[] values = getDoubleValues(strValue);
00096 if(values.length > 3)
00097 throw new InvalidChoiceException("Wrong pixel value (too many components)");
00098
00099 switch (values.length) {
00100 case 1:
00101 val.scalarDouble(values[0]);
00102 return val;
00103 case 2:
00104 val.vect2Double(new HxCorba.Vec2D(values[0], values[1]));
00105 return val;
00106 case 3:
00107 val.vect3Double(new HxCorba.Vec3D(values[0], values[1], values[2]));
00108 return val;
00109 }
00110 }catch(NumberFormatException e) {
00111 }
00112
00113 throw new InvalidChoiceException("Wrong pixel value (wrong number)");
00114 }
|
|
|
Returns the object introduced as that text. Useful method to implement setArgument. Reimplemented from CorbaObjectChoice.
00117 {
00118 try {
00119 return getPixValue(name);
00120 }catch(InvalidChoiceException e) {
00121 _input.requestFocus();
00122 throw e;
00123 }
00124 }
|
|
|
Converts that object to string. Useful method to implement getResult. Reimplemented from CorbaObjectChoice.
00127 {
00128 HxCorba.PixValue val = (HxCorba.PixValue)obj;
00129 if(val.discriminator() == HxCorba.PixValueTag.SI) {
00130 int res = val.scalarInt();
00131 return ""+res;
00132 }
00133 else if(val.discriminator() == HxCorba.PixValueTag.SD) {
00134 double res = val.scalarDouble();
00135 return ""+res;
00136 }
00137 else if(val.discriminator() == HxCorba.PixValueTag.V2I) {
00138 HxCorba.Vec2I res = val.vect2Int();
00139 return "{"+res.x+", "+res.y+"}";
00140 }
00141 else if(val.discriminator() == HxCorba.PixValueTag.V2D) {
00142 HxCorba.Vec2D res = val.vect2Double();
00143 return "{"+res.x+", "+res.y+"}";
00144 }
00145 else if(val.discriminator() == HxCorba.PixValueTag.V3I) {
00146 HxCorba.Vec3I res = val.vect3Int();
00147 return "{"+res.x+", "+res.y+", "+res.z+"}";
00148 }
00149 else if(val.discriminator() == HxCorba.PixValueTag.V3D) {
00150 HxCorba.Vec3D res = val.vect3Double();
00151 return "{"+res.x+", "+res.y+", "+res.z+"}";
00152 }
00153 return "unknown";
00154 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001