001/*
002 * Copyright (c) 2009-2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: berkley $'
006 * '$Date: 2010-04-28 00:12:36 +0000 (Wed, 28 Apr 2010) $' 
007 * '$Revision: 24000 $'
008 * 
009 * Permission is hereby granted, without written agreement and without
010 * license or royalty fees, to use, copy, modify, and distribute this
011 * software and its documentation for any purpose, provided that the above
012 * copyright notice and the following two paragraphs appear in all copies
013 * of this software.
014 *
015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
019 * SUCH DAMAGE.
020 *
021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
026 * ENHANCEMENTS, OR MODIFICATIONS.
027 *
028 */
029
030package org.kepler.gui;
031
032import java.awt.Dimension;
033import java.awt.Frame;
034import java.awt.event.ActionEvent;
035import java.awt.event.ActionListener;
036
037import javax.swing.Box;
038import javax.swing.BoxLayout;
039import javax.swing.JButton;
040import javax.swing.JDialog;
041import javax.swing.JLabel;
042import javax.swing.JPanel;
043import javax.swing.JTextField;
044
045/**
046 * @author Chad Berkley
047 * This class is work in progress.  It may not function.
048 * A class to allow users to add a new remote repository
049 */
050public class AddRemoteRepositoryDialog extends JDialog 
051{
052  JButton okButton;
053  JButton cancelButton;
054  JPanel topPanel;
055  JTextField repositoryNameTextArea;
056  JTextField repositoryServerTextArea;
057  
058  /**
059   * constructor
060   */
061  public AddRemoteRepositoryDialog(Frame owner, String title, Boolean modal)
062  {
063    super(owner, title, modal);
064    System.out.println("AddRemoteRepositoryDialog opening.");
065    init();
066  }
067  
068  public void init() 
069  { 
070    topPanel = new JPanel();
071    
072    okButton = new JButton("Ok");
073    okButton.setPreferredSize(new Dimension(100, 50));
074    okButton.addActionListener(new ActionListener() {
075      public void actionPerformed(ActionEvent e)
076      {
077        
078      }
079    });
080    
081    cancelButton = new JButton("Cancel");
082    cancelButton.setPreferredSize(new Dimension(100, 50));
083    cancelButton.addActionListener(new ActionListener() {
084      public void actionPerformed(ActionEvent e)
085      {
086        setVisible(false);
087      }
088    });
089    
090    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
091    
092    repositoryNameTextArea = new JTextField();
093    repositoryNameTextArea.setMaximumSize(new Dimension(200, 20));
094    
095    repositoryServerTextArea = new JTextField();
096    repositoryServerTextArea.setMaximumSize(new Dimension(200, 20));
097    
098    JLabel nameLabel = new JLabel("Repository Name");
099    JLabel serverLabel = new JLabel("Repository Server");
100    nameLabel.setMaximumSize(new Dimension(150, 20));
101    serverLabel.setMaximumSize(new Dimension(150, 20));
102    
103    JPanel namePanel = new JPanel();
104    namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.X_AXIS));
105    namePanel.add(Box.createRigidArea(new Dimension(5,0)));
106    namePanel.add(nameLabel);
107    namePanel.add(repositoryNameTextArea);
108    namePanel.add(Box.createRigidArea(new Dimension(5,0)));
109    
110    JPanel serverPanel = new JPanel();
111    serverPanel.add(Box.createRigidArea(new Dimension(5,0)));
112    serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.X_AXIS));
113    serverPanel.add(serverLabel);
114    serverPanel.add(repositoryServerTextArea);
115    serverPanel.add(Box.createRigidArea(new Dimension(5,0)));
116    
117    JPanel inputsPanel = new JPanel();
118    inputsPanel.setLayout(new BoxLayout(inputsPanel, BoxLayout.Y_AXIS));
119    inputsPanel.setMaximumSize(new Dimension(350, 50));
120    inputsPanel.add(Box.createRigidArea(new Dimension(0,5)));
121    inputsPanel.add(namePanel);
122    inputsPanel.add(Box.createRigidArea(new Dimension(0,5)));
123    inputsPanel.add(serverPanel);
124    inputsPanel.add(Box.createRigidArea(new Dimension(0,5)));
125    
126    topPanel.add(Box.createRigidArea(new Dimension(0,5)));
127    topPanel.add(inputsPanel);
128    topPanel.add(Box.createRigidArea(new Dimension(0,5)));
129    
130    JPanel buttonPanel = new JPanel();
131    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
132    //buttonPanel.setMaximumSize(new Dimension(350, 40));
133    buttonPanel.add(okButton);
134    buttonPanel.add(cancelButton);
135    topPanel.add(buttonPanel);
136    
137    
138    setSize(new Dimension(370, 150));
139    
140    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
141    setContentPane(topPanel);
142  }
143  
144  private void writeConfig()
145  {
146    
147  }
148}