/** Selects a subview for a currently selected DataSource factory. */ protected void showDataSourceSubview(String factoryName) { DataSourceEditor c = (DataSourceEditor) datasourceEditors.get(factoryName); // create subview dynamically... if (c == null) { if (XMLPoolingDataSourceFactory.class.getName().equals(factoryName)) { c = new JDBCDataSourceEditor((ProjectController) getParent(), nodeChangeProcessor); } else if (JNDIDataSourceFactory.class.getName().equals(factoryName)) { c = new JNDIDataSourceEditor((ProjectController) getParent(), nodeChangeProcessor); } else if (DBCPDataSourceFactory.class.getName().equals(factoryName)) { c = new DBCPDataSourceEditor((ProjectController) getParent(), nodeChangeProcessor); } else { // special case - no detail view, just show it and bail.. defaultSubeditor.setNode(node); disabledTab("default"); view.getDataSourceDetailLayout().show(view.getDataSourceDetail(), "default"); return; } datasourceEditors.put(factoryName, c); view.getDataSourceDetail().add(c.getView(), factoryName); // this is needed to display freshly added panel... view.getDataSourceDetail().getParent().validate(); } // this will refresh subview... c.setNode(node); disabledTab(factoryName); // display the right subview... view.getDataSourceDetailLayout().show(view.getDataSourceDetail(), factoryName); }
protected void initController() { view.getDataSourceDetail().add(defaultSubeditor.getView(), "default"); view.getFactories().setEditable(true); // init combo box choices view.getFactories().setModel(new DefaultComboBoxModel(standardDataSourceFactories)); view.getSchemaUpdateStrategy().setEditable(true); view.getSchemaUpdateStrategy().setModel(new DefaultComboBoxModel(standardSchemaUpdateStrategy)); // init listeners ((ProjectController) getParent()) .addDataNodeDisplayListener( new DataNodeDisplayListener() { public void currentDataNodeChanged(DataNodeDisplayEvent e) { refreshView(e.getDataNode()); } }); getView() .addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { refreshView( node != null ? node : ((ProjectController) getParent()).getCurrentDataNode()); } }); BindingBuilder builder = new BindingBuilder(getApplication().getBindingFactory(), this); localDataSourceBinding = builder.bindToComboSelection( view.getLocalDataSources(), "parent.dataNodePreferences.localDataSource", NO_LOCAL_DATA_SOURCE); // use delegate for the rest of them builder.setDelegate(nodeChangeProcessor); bindings = new ObjectBinding[3]; bindings[0] = builder.bindToTextField(view.getDataNodeName(), "nodeName"); bindings[1] = builder.bindToComboSelection(view.getFactories(), "factoryName"); bindings[2] = builder.bindToComboSelection(view.getSchemaUpdateStrategy(), "schemaUpdateStrategy"); // one way bindings builder.bindToAction(view.getConfigLocalDataSources(), "dataSourceConfigAction()"); }