Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 
 package org.apache.cayenne.modeler.dialog.pref;
 
 
 
 import  com.jgoodies.forms.builder.DefaultFormBuilder;
 import  com.jgoodies.forms.layout.FormLayout;

A generic panel for entering DataSource information.

Author(s):
Andrei Adamchik
 
 public class DBConnectionInfoEditorView extends JPanel {
 
     protected JComboBox adapters;
     protected JTextField driver;
     protected JTextField url;
     protected JTextField userName;
     protected JPasswordField password;
 
     protected Collection labels;
 
     public DBConnectionInfoEditorView() {
          = new JComboBox();
         .setEditable(true);
 
          = new JTextField();
          = new JTextField();
          = new JTextField();
          = new JPasswordField();
          = new ArrayList();
 
         // assemble
         FormLayout layout = new FormLayout("right:pref, 3dlu, fill:160dlu:grow""");
         DefaultFormBuilder builder = new DefaultFormBuilder(layout);
         builder.setDefaultDialogBorder();
 
         .add(builder.append("JDBC Driver:"));
         .add(builder.append("DB URL:"));
         .add(builder.append("User Name:"));
         .add(builder.append("Password:"));
         .add(builder.append("Adapter (optional):"));
 
         this.setLayout(new BorderLayout());
         this.add(builder.getPanel(), .);
     }
 
     public JComboBox getAdapters() {
         return ;
     }
 
     public JTextField getDriver() {
         return ;
     }
 
     public JPasswordField getPassword() {
         return ;
     }
 
     public JTextField getUrl() {
         return ;
     }
 
     public JTextField getUserName() {
         return ;
     }
 
     public void setEnabled(boolean enabled) {
         if (isEnabled() != enabled) {
             super.setEnabled(enabled);
             Iterator it = .iterator();
            while (it.hasNext()) {
                Component c = (Componentit.next();
                c.setEnabled(enabled);
            }
            .setEnabled(enabled);
            .setEnabled(enabled);
            .setEnabled(enabled);
            .setEnabled(enabled);
            .setEnabled(enabled);
        }
    }
New to GrepCode? Check out our FAQ X