1 23 package org.enhydra.kelp.jbuilder.properties; 24 25 import com.borland.jbuilder.node.JBProject; 27 import com.borland.primetime.help.HelpTopic; 28 import com.borland.primetime.help.ZipHelpTopic; 29 import com.borland.primetime.properties.PropertyPage; 30 31 import org.enhydra.kelp.KelpInfo; 33 import org.enhydra.kelp.common.node.OtterProject; 34 import org.enhydra.kelp.common.properties.XMLCProjectPropertyPanel; 35 import org.enhydra.kelp.jbuilder.node.PrimeProject; 36 37 import java.awt.BorderLayout ; 39 import java.awt.Dimension ; 40 import java.beans.Beans ; 41 import java.lang.ref.WeakReference ; 42 43 public class XMLCProjectPropertyPage extends PropertyPage { 45 46 private final String HELP_LINK = KelpInfo.getAddinHelpURL(); 49 private WeakReference projectRef = null; 51 private XMLCProjectPropertyPanel propertyPanel = null; 52 private BorderLayout layoutMain = null; 53 54 public XMLCProjectPropertyPage(Object topic) { 55 if (topic instanceof JBProject) { 56 OtterProject otterProject = null; 57 58 otterProject = new PrimeProject((JBProject) topic); 59 projectRef = new WeakReference (otterProject); 60 try { 61 jbInit(); 62 pmInit(); 63 } catch (Exception e) { 64 e.printStackTrace(); 65 } 66 } 67 } 68 69 public void readProperties() { 70 propertyPanel.read(getProject()); 71 enableUI(true); 72 } 73 74 public HelpTopic getHelpTopic() { 75 ZipHelpTopic topic = null; 76 77 topic = new ZipHelpTopic(null, HELP_LINK); 78 return topic; 79 } 80 81 public void writeProperties() { 82 propertyPanel.save(); 83 } 84 85 public XMLCProjectPropertyPage() { 86 try { 87 jbInit(); 88 } catch (Exception e) { 89 e.printStackTrace(); 90 } 91 } 92 93 private void enableUI(boolean enabled) {} 97 98 private void jbInit() throws Exception { 99 layoutMain = new BorderLayout (); 100 propertyPanel = new XMLCProjectPropertyPanel(); 101 propertyPanel.setPreferredSize(new Dimension (0, 0)); 102 this.setLayout(layoutMain); 103 this.add(propertyPanel, BorderLayout.CENTER); 104 } 105 106 private void pmInit() { 107 propertyPanel.read(getProject()); 108 } 109 110 private OtterProject getProject() { 111 OtterProject otterProject = null; 112 113 if (projectRef != null) { 114 otterProject = (OtterProject) projectRef.get(); 115 } 116 return otterProject; 117 } 118 119 } 120 | Popular Tags |