svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extExpressionField / src / org / gvsig / expressionfield / project / documents / table / operators / SetTimeDate.java @ 39133
History | View | Annotate | Download (1.63 KB)
1 |
package org.gvsig.expressionfield.project.documents.table.operators; |
---|---|
2 |
|
3 |
import org.apache.bsf.BSFException; |
4 |
import org.apache.bsf.BSFManager; |
5 |
import org.gvsig.andami.PluginServices; |
6 |
import org.gvsig.expressionfield.ExpressionFieldExtension; |
7 |
import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
8 |
import org.gvsig.expressionfield.project.documents.table.IOperator; |
9 |
|
10 |
|
11 |
/**
|
12 |
* @author Vicente Caballero Navarro
|
13 |
*/
|
14 |
public class SetTimeDate extends AbstractOperator{ |
15 |
|
16 |
public String addText(String s) { |
17 |
return toString()+"("+s+")"; |
18 |
} |
19 |
public String toString() { |
20 |
return "setTimeDate"; |
21 |
} |
22 |
public void eval(BSFManager interpreter) throws BSFException { |
23 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"java.util.Date setTimeDate(java.lang.Object value1,double value2){value1.setTime((long)value2);return value1;};");
|
24 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1, |
25 |
"import java.util.Date as jDate\n"+
|
26 |
"def setTimeDate(value):\n"+
|
27 |
" aux = jDate()\n"+
|
28 |
" aux.setTime(long(value))\n"+
|
29 |
" return aux");
|
30 |
} |
31 |
public boolean isEnable() { |
32 |
return (getType()==IOperator.DATE);
|
33 |
} |
34 |
|
35 |
public String getDescription() { |
36 |
return PluginServices.getText(this, "parameter") + ": " + |
37 |
PluginServices.getText(this, "numeric_value") + "\n"+ |
38 |
PluginServices.getText(this, "returns") + ": " + |
39 |
PluginServices.getText(this, "date_value") + "\n" + |
40 |
PluginServices.getText(this, "description") + ": " + |
41 |
"Returns a date object to represent a point in time that is 'parameter' milliseconds after January 1, 1970 00:00:00 GMT.";
|
42 |
} |
43 |
} |