1 22 package org.enhydra.kelp.jbuilder.node; 23 24 import org.enhydra.tool.common.PathHandle; 26 27 import org.enhydra.kelp.common.Constants; 29 import org.enhydra.kelp.common.PropUtil; 30 import org.enhydra.kelp.common.node.OtterProject; 31 import org.enhydra.kelp.common.node.OtterNode; 32 import org.enhydra.kelp.common.node.OtterDocumentNode; 33 import org.enhydra.kelp.common.node.PropertyKeys; 34 35 import com.borland.primetime.node.FileNode; 37 import com.borland.primetime.vfs.InvalidUrlException; 38 39 import java.io.IOException ; 41 42 49 public class PrimeDocumentNode extends PrimeNode 50 implements OtterDocumentNode { 51 52 public PrimeDocumentNode(FileNode n) { 54 super(n); 55 } 56 57 64 public PrimeDocumentNode(OtterNode otterNode, String path) { 65 super(otterNode, path); 66 } 67 68 public void setSelected(boolean b) { 69 super.setSelected(b); 70 if (b) { 71 setStatic(false); 72 } 73 } 74 75 public boolean isStatic() { 76 String in = getProperty(PropertyKeys.NAME_RESOURCE_STATIC); 77 78 return PropUtil.stringToBoolean(in, false); 79 } 80 81 public void setStatic(boolean b) { 82 setProperty(PropertyKeys.NAME_RESOURCE_STATIC, 83 PropUtil.booleanToString(b)); 84 if (b) { 85 setSelected(false); 86 } 87 } 88 89 public void preCompile() { 90 if (getNativeNode() instanceof FileNode) { 91 FileNode nativeNode = (FileNode) getNativeNode(); 92 93 if (nativeNode.isModified()) { 94 try { 95 nativeNode.save(); 96 } catch (InvalidUrlException e) { 97 e.printStackTrace(); 98 } catch (IOException e) { 99 e.printStackTrace(); 100 } 101 } 102 } 103 } 104 105 } 106 | Popular Tags |