Revision 28291
branches/v2_0_0_prep/extensions/extExpressionField/src/com/iver/cit/gvsig/project/documents/table/gui/EvalExpressionDialog.java | ||
---|---|---|
11 | 11 |
import java.io.File; |
12 | 12 |
import java.io.FileReader; |
13 | 13 |
import java.io.IOException; |
14 |
import java.io.UnsupportedEncodingException; |
|
14 | 15 |
import java.util.ArrayList; |
15 | 16 |
import java.util.Iterator; |
16 | 17 |
import java.util.prefs.Preferences; |
... | ... | |
279 | 280 |
* @throws BSFException |
280 | 281 |
*/ |
281 | 282 |
private boolean evalExpression() throws BSFException{ |
282 |
String expression=getTxtExp().getText() |
|
283 |
.replaceAll("\\[","field(\"") |
|
284 |
.replaceAll("\\]","\")"); |
|
283 |
|
|
284 |
|
|
285 |
String expression=getTxtExp().getText(); |
|
286 |
byte[] expressionBytes; |
|
287 |
String encoding = System.getProperty("file.encoding"); |
|
288 |
try { |
|
289 |
expressionBytes = expression.getBytes(encoding); |
|
290 |
expression = new String(expressionBytes, "ISO-8859-1"); |
|
291 |
} catch (UnsupportedEncodingException e) { |
|
292 |
// TODO Auto-generated catch block |
|
293 |
e.printStackTrace(); |
|
294 |
} |
|
295 |
expression=expression.replaceAll("\\[","field(\"").replaceAll("\\]","\")"); |
|
296 |
|
|
285 | 297 |
interpreter.declareBean("evalExpression",evalExpression,EvalExpression.class); |
286 | 298 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def expression():\n" + |
287 | 299 |
" return " +expression+ ""); |
Also available in: Unified diff