root / tags / v2_0_0_Build_2035 / extensions / extExpressionField / src / org / gvsig / expressionfield / project / documents / table / operators / IndexOf.java @ 36300
History | View | Annotate | Download (1.67 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 IndexOf extends AbstractOperator{ |
15 |
|
16 |
public String addText(String s) { |
17 |
return toString()+"("+s+", \"\")"; |
18 |
} |
19 |
public String toString() { |
20 |
return "indexOf"; |
21 |
} |
22 |
public void eval(BSFManager interpreter) throws BSFException { |
23 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def indexOf(value1,value2):\n" + |
24 |
" return value1.find(value2)");
|
25 |
} |
26 |
public boolean isEnable() { |
27 |
return (getType()==IOperator.STRING);
|
28 |
} |
29 |
public String getTooltip(){ |
30 |
return PluginServices.getText(this,"operator")+": " + |
31 |
toString()+ |
32 |
"("+PluginServices.getText(this,"parameter")+"1,"+PluginServices.getText(this,"parameter")+"2)\n"+ |
33 |
getDescription(); |
34 |
} |
35 |
|
36 |
public String getDescription() { |
37 |
return PluginServices.getText(this, "parameter") + "1"+": " + |
38 |
PluginServices.getText(this, "string_value") + "\n"+ |
39 |
PluginServices.getText(this, "parameter") + "2"+": " + |
40 |
PluginServices.getText(this, "string_value") + "\n"+ |
41 |
PluginServices.getText(this, "returns") + ": " + |
42 |
PluginServices.getText(this, "integer_value") + "\n" + |
43 |
PluginServices.getText(this, "description") + ": " + |
44 |
"Returns the index within parameter1 of the first occurrence of the parameter2.";
|
45 |
} |
46 |
} |