打字猴:1.7004854e+09
1700485400
1700485401 它是一个抽象类,其中的getView是一个抽象方法,是根据执行结果查找到视图路径。只要编写一个适配器就可以把Elemet对象转为Action节点,如代码清单38-28所示。
1700485402
1700485403 代码清单38-28 Action节点
1700485404
1700485405 public class XmlActionNode extends ActionNode{
1700485406
1700485407 //需要转换的element
1700485408
1700485409 private Element el;
1700485410
1700485411 //通过构造函数传递
1700485412
1700485413 public XmlActionNode(Element_el){
1700485414
1700485415 this.el=_el;
1700485416
1700485417 }
1700485418
1700485419 @Override
1700485420
1700485421 public String getActionName(){
1700485422
1700485423 return getAttValue(“name”);
1700485424
1700485425 }
1700485426
1700485427 @Override
1700485428
1700485429 public String getActionClass(){
1700485430
1700485431 return getAttValue(“class”);
1700485432
1700485433 }
1700485434
1700485435 @Override
1700485436
1700485437 public String getMethodName(){
1700485438
1700485439 return getAttValue(“method”);
1700485440
1700485441 }
1700485442
1700485443 public String getView(String result){
1700485444
1700485445 ViewPathVisitor visitor=new ViewPathVisitor(“success”);
1700485446
1700485447 el.accept(visitor);
1700485448
1700485449 return visitor.getViewPath();
[ 上一页 ]  [ :1.7004854e+09 ]  [ 下一页 ]