1 56 package org.objectstyle.cayenne.modeler.editor.datanode; 57 58 import java.awt.BorderLayout ; 59 import java.awt.CardLayout ; 60 61 import javax.swing.JButton ; 62 import javax.swing.JComboBox ; 63 import javax.swing.JPanel ; 64 import javax.swing.JTextField ; 65 66 import com.jgoodies.forms.builder.DefaultFormBuilder; 67 import com.jgoodies.forms.layout.FormLayout; 68 69 72 public class DataNodeView extends JPanel { 73 74 protected JTextField dataNodeName; 75 protected JComboBox factories; 76 protected JPanel dataSourceDetail; 77 protected CardLayout dataSourceDetailLayout; 78 protected JComboBox adapters; 79 protected JComboBox localDataSources; 80 protected JButton configLocalDataSources; 81 82 public DataNodeView() { 83 84 this.dataNodeName = new JTextField (); 86 this.factories = new JComboBox (); 87 this.adapters = new JComboBox (); 88 this.localDataSources = new JComboBox (); 89 90 this.dataSourceDetailLayout = new CardLayout (); 91 this.dataSourceDetail = new JPanel (dataSourceDetailLayout); 92 93 this.configLocalDataSources = new JButton ("..."); 94 this.configLocalDataSources.setToolTipText("configure local DataSource"); 95 96 98 DefaultFormBuilder topPanelBuilder = new DefaultFormBuilder(new FormLayout( 99 "right:80dlu, 3dlu, fill:177dlu, 3dlu, fill:20dlu", 100 "")); 101 topPanelBuilder.setDefaultDialogBorder(); 102 103 topPanelBuilder.appendSeparator("DataNode Configuration"); 104 topPanelBuilder.append("DataNode Name:", dataNodeName, 3); 105 topPanelBuilder.append("DB Adapter:", adapters, 3); 106 topPanelBuilder.append( 107 "Local DataSource (opt.):", 108 localDataSources, 109 configLocalDataSources); 110 topPanelBuilder.append("DataSource Factory:", factories, 3); 111 112 setLayout(new BorderLayout ()); 113 add(topPanelBuilder.getPanel(), BorderLayout.NORTH); 114 add(dataSourceDetail, BorderLayout.CENTER); 115 } 116 117 public JComboBox getAdapters() { 118 return adapters; 119 } 120 121 public JTextField getDataNodeName() { 122 return dataNodeName; 123 } 124 125 public JPanel getDataSourceDetail() { 126 return dataSourceDetail; 127 } 128 129 public JComboBox getLocalDataSources() { 130 return localDataSources; 131 } 132 133 public CardLayout getDataSourceDetailLayout() { 134 return dataSourceDetailLayout; 135 } 136 137 public JComboBox getFactories() { 138 return factories; 139 } 140 141 public JButton getConfigLocalDataSources() { 142 return configLocalDataSources; 143 } 144 } | Popular Tags |