1 22 package org.enhydra.kelp.jbuilder.properties; 23 24 import com.borland.jbuilder.node.JBProject; 26 import com.borland.primetime.help.HelpTopic; 27 import com.borland.primetime.help.ZipHelpTopic; 28 import com.borland.primetime.properties.PropertyPage; 29 30 import org.enhydra.tool.common.DataValidationException; 32 33 import org.enhydra.kelp.KelpInfo; 35 import org.enhydra.kelp.common.node.OtterProject; 36 import org.enhydra.kelp.common.dods.DodsInnerPanel; 37 38 import org.enhydra.kelp.jbuilder.node.PrimeProject; 40 41 import java.awt.BorderLayout ; 43 import java.awt.Dimension ; 44 import java.beans.Beans ; 45 import javax.swing.JOptionPane ; 46 47 public class DodsProjectPropertyPage extends PropertyPage { 49 50 private final String HELP_LINK = KelpInfo.getAddinHelpURL(); 53 private OtterProject otterProject; 55 private DodsInnerPanel propertyPanel; 56 private BorderLayout layoutMain; 57 58 public DodsProjectPropertyPage(Object topic) { 59 if (topic instanceof JBProject) { 60 JBProject nativeProject = null; 61 PrimeProject primeProject = null; 62 63 nativeProject = (JBProject) topic; 64 otterProject = new PrimeProject(nativeProject); 65 try { 66 jbInit(); 67 } catch (Exception e) { 68 e.printStackTrace(); 69 } 70 } 71 } 72 73 public void readProperties() { 74 propertyPanel.read(otterProject); 75 enableUI(true); 76 } 77 78 public HelpTopic getHelpTopic() { 79 ZipHelpTopic t = new ZipHelpTopic(null, HELP_LINK); 80 81 return t; 82 } 83 84 public void writeProperties() { 85 try { 86 propertyPanel.write(otterProject); 87 } catch (DataValidationException e) { 88 e.printStackTrace(System.err); 89 JOptionPane.showMessageDialog(this, e.getValidationMessage()); 90 } 91 } 92 93 public DodsProjectPropertyPage() { 94 try { 95 jbInit(); 96 } catch (Exception e) { 97 e.printStackTrace(); 98 } 99 } 100 101 private void enableUI(boolean enabled) {} 102 103 private void jbInit() throws Exception { 104 layoutMain = 105 (BorderLayout ) Beans.instantiate(getClass().getClassLoader(), 106 BorderLayout .class.getName()); 107 propertyPanel = 108 (DodsInnerPanel) Beans.instantiate(getClass().getClassLoader(), 109 DodsInnerPanel.class.getName()); 110 propertyPanel.setPreferredSize(new Dimension (0, 0)); 111 this.setLayout(layoutMain); 112 this.add(propertyPanel, BorderLayout.CENTER); 113 } 114 115 } 116 | Popular Tags |