1 package org.enhydra.kelp.ant.node; 2 import org.enhydra.kelp.common.node.OtterFileNode; 4 import org.enhydra.kelp.common.node.OtterProject; 5 import org.enhydra.kelp.common.node.OtterNode; 6 import org.enhydra.kelp.common.node.PropertyKeys; 7 import org.enhydra.kelp.common.PropUtil; 8 import org.enhydra.tool.common.PathHandle; 10 11 19 20 public class AntFileNode implements OtterFileNode { 21 22 protected Throwable exception = null; 23 protected OtterNode otterNode = null; 24 protected String path = null; 25 protected OtterProject project = null; 26 protected String selected = "false"; 28 29 public AntFileNode(OtterNode node) { 30 otterNode = node; 31 project = otterNode.getProject(); 32 } 33 public AntFileNode(OtterNode node,String filePath) { 34 this(node); 35 path = filePath; 36 } 37 public String getFilePath() { 38 return path; 39 } 40 public String getProperty(String property) { 41 if(property.equalsIgnoreCase(PropertyKeys.NAME_SELECTED)) 42 return selected; else 44 return project.getProperty(property); } 46 public void setProperty(String property, String value) { 47 if(property.equalsIgnoreCase(PropertyKeys.NAME_SELECTED)) 48 selected = value; 49 else 50 project.setProperty(property,value); } 52 public void setProperty(String property, int value) { 53 project.setProperty(property,value); } 55 public Object getNativeNode() { 56 return null; 57 } 58 public void setNativeNode(Object o) { 59 60 throw new java.lang.UnsupportedOperationException ("Method setNativeNode() not yet implemented."); 61 } 62 public OtterProject getProject() { 63 return project; 64 } 65 public OtterNode getParent() { 66 if(otterNode instanceof OtterProject) 67 return otterNode; 68 else 69 return otterNode.getParent(); 70 } 71 public String getXMLCOptionFilePath() { 72 return project.getXMLCOptionFilePath(); } 74 public void setXMLCOptionFilePath(String n) { 75 project.setXMLCOptionFilePath(n); } 77 public String getXMLCParameters() { 78 return project.getXMLCParameters(); } 80 public void setXMLCParameters(String p) { 81 project.setXMLCParameters(p); 82 } 83 public boolean isSelected() { 84 String in = getProperty(PropertyKeys.NAME_SELECTED); 85 return PropUtil.stringToBoolean(in, false); 86 } 87 public void setSelected(boolean b) { 88 setProperty(PropertyKeys.NAME_SELECTED, PropUtil.booleanToString(b)); 89 } 90 97 public void setException(Throwable e) { 98 exception = e; 99 } 100 101 105 public Throwable getException() { 106 return exception; 107 } 108 public void save() { 109 } 112 113 } | Popular Tags |