1 23 24 package org.enhydra.kelp.forte.node; 25 26 import org.enhydra.tool.common.ToolException; 28 import org.enhydra.tool.common.PathHandle; 29 30 import org.enhydra.kelp.common.ResUtil; 32 import org.enhydra.kelp.common.PropUtil; 33 import org.enhydra.kelp.common.PathUtil; 34 import org.enhydra.kelp.common.node.OtterProject; 35 import org.enhydra.kelp.common.node.OtterNode; 36 import org.enhydra.kelp.common.node.OtterTemplateNode; 37 38 import org.openide.util.NbBundle; 40 import org.openide.loaders.DataNode; 41 import org.openide.nodes.Node; 42 43 44 import java.io.File ; 46 47 52 public class ForteTemplateNode extends ForteNode implements OtterTemplateNode{ 53 54 public ForteTemplateNode(DeployDataObject n) throws ToolException { 55 super(n); 56 if (!PathUtil.isTemplate(this)) { 57 StringBuffer buf = new StringBuffer (); 58 59 buf.append(NbBundle.getMessage (ForteTemplateNode.class, "MSG_Invalid_template_node")); 60 61 buf.append('\n'); 62 buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Node_file_path_0_")); 63 buf.append(getFilePath()); 64 65 buf.append('\n'); 66 buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Deploy_input_path_0_")); 67 buf.append(getProject().getDeployInputPath()); 68 throw new ToolException(buf.toString()); 69 } 70 } 71 72 73 public ForteTemplateNode(DodsDataObject n) throws ToolException { 74 super(n); 75 if (!PathUtil.isTemplate(this)) { 76 StringBuffer buf = new StringBuffer (); 77 78 buf.append(NbBundle.getMessage (ForteTemplateNode.class, "MSG_Invalid_template_node")); 79 80 buf.append('\n'); 81 buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Node_file_path_0_")); 82 buf.append(getFilePath()); 83 84 buf.append('\n'); 85 buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Deploy_input_path_0_")); 86 buf.append(getProject().getDeployInputPath()); 87 throw new ToolException(buf.toString()); 88 } 89 } 90 91 98 public ForteTemplateNode(OtterNode otterNode, String file) { 99 super(otterNode, file); 100 } 101 102 public boolean isSelected() 103 { 104 String in = getProperty(NAME_SELECTED); 105 return PropUtil.stringToBoolean(in, false); 106 } 107 108 public void setSelected(boolean b) { 109 setProperty(NAME_SELECTED, PropUtil.booleanToString(b)); 110 } 111 112 public String getProperty(String property) 113 { 114 String out = ""; 115 116 if (nativeNode != null) { 117 out = ((DeployDataObject)nativeNode).getProperty(property); 118 } 119 120 return out; 121 } 122 123 130 public void setProperty(String property, String value) 131 { 132 if (nativeNode != null) { 133 ((DeployDataObject)nativeNode).setProperty(property, value); 134 } 135 } 136 137 public String getOutputPath() { 139 return PathUtil.getOutputPath(this); 140 } 141 142 143 } 144 | Popular Tags |