1 23 package org.enhydra.kelp.jbuilder.properties; 24 25 import com.borland.jbuilder.node.HTMLFileNode; 27 import com.borland.primetime.help.HelpTopic; 28 import com.borland.primetime.help.ZipHelpTopic; 29 import com.borland.primetime.node.TextFileNode; 30 import com.borland.primetime.properties.PropertyPage; 31 32 import org.enhydra.kelp.KelpInfo; 34 import org.enhydra.kelp.common.node.OtterDocumentNode; 35 import org.enhydra.kelp.common.node.OtterXMLCNode; 36 import org.enhydra.kelp.common.properties.XMLCNodePropertyPanel; 37 38 import org.enhydra.kelp.jbuilder.node.PrimeDocumentNode; 40 41 import java.awt.BorderLayout ; 43 import java.lang.ref.WeakReference ; 44 45 51 public class XMLCNodePropertyPage extends PropertyPage { 52 53 private final String HELP_LINK = KelpInfo.getAddinHelpURL(); 56 private XMLCNodePropertyPanel nodePanel = new XMLCNodePropertyPanel(); 58 private BorderLayout layoutMain = new BorderLayout (); 59 private WeakReference nodeRef = null; 60 61 66 public XMLCNodePropertyPage(Object topic) { 67 if (topic instanceof TextFileNode) { 68 OtterXMLCNode xmlcNode = null; 69 OtterDocumentNode docNode = null; 70 TextFileNode nativeText = (TextFileNode) topic; 71 72 docNode = new PrimeDocumentNode(nativeText); 73 xmlcNode = new OtterXMLCNode(docNode); 74 nodeRef = new WeakReference (xmlcNode); 75 try { 76 nodePanel.read(xmlcNode); 77 jbInit(); 78 } catch (Exception e) { 79 e.printStackTrace(); 80 } 81 } 82 } 83 84 88 public void readProperties() { 89 OtterXMLCNode node = null; 90 91 if (nodeRef != null) { 92 node = (OtterXMLCNode) nodeRef.get(); 93 nodePanel.read(node); 94 } 95 } 96 97 103 public HelpTopic getHelpTopic() { 104 ZipHelpTopic t = new ZipHelpTopic(null, HELP_LINK); 105 106 return t; 107 } 108 109 113 public void writeProperties() { 114 nodePanel.save(); 115 } 116 117 121 public XMLCNodePropertyPage() { 122 try { 123 jbInit(); 124 } catch (Exception e) { 125 e.printStackTrace(); 126 } 127 } 128 129 133 139 private void jbInit() throws Exception { 140 this.setLayout(layoutMain); 141 this.add(nodePanel, BorderLayout.CENTER); 142 } 143 144 } 145 | Popular Tags |