001/*
002 * Copyright (c) 2004-2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: welker $'
006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 
007 * '$Revision: 24234 $'
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.ecoinformatics.seek.ecogrid;
031
032import java.awt.BorderLayout;
033import java.util.Vector;
034
035import javax.swing.Box;
036import javax.swing.BoxLayout;
037import javax.swing.JButton;
038import javax.swing.JPanel;
039
040/**
041 * This class represents a frame for service list modification
042 * 
043 * @author Jing Tao
044 */
045
046public class SearchRegistryResultFrame extends EcogridPreferencesTab {
047        private JButton okButton = null;
048        private JButton cancelButton = null;
049        private EcogridPreferencesTab parent = null;
050
051        private static final String TEXT = "Data Source(s) in Registry:";
052
053        /**
054         * Constructor for the frame
055         * 
056         * @param frameTitle
057         *            String
058         * @param selectedServiceList
059         *            Vector
060         */
061        public SearchRegistryResultFrame(EcogridPreferencesTab parent) {
062                super();
063                setDisplayText(TEXT);
064                this.parent = parent;
065                initButtonPanel();
066        }// ServicesListModificationFrame
067
068        /*
069         * This method will init button panel
070         */
071        private void initButtonPanel() {
072
073                okButton = new JButton(new AddServicesFromRegistrySearchAction("Add",
074                                this, parent));
075                okButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
076                okButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);
077                cancelButton = new JButton(new CancelSearchAction("Cancel", this.parentFrame,
078                                parent));
079                cancelButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
080                cancelButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);
081                JPanel bottomPanel = new JPanel();
082                bottomPanel.setLayout(new BorderLayout());
083                JPanel leftPart = new JPanel();
084                leftPart.setLayout(new BoxLayout(leftPart, BoxLayout.X_AXIS));
085                leftPart.add(okButton);
086                leftPart.add(Box
087                                .createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE));
088                leftPart.add(cancelButton);
089                bottomPanel.add(Box.createHorizontalGlue(), BorderLayout.WEST);
090                bottomPanel.add(leftPart, BorderLayout.EAST);
091
092                JPanel newButtonPanel = new JPanel();
093                newButtonPanel.setLayout(new BorderLayout());
094                newButtonPanel.add(Box
095                                .createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE),
096                                BorderLayout.NORTH);
097                newButtonPanel.add(bottomPanel, BorderLayout.SOUTH);
098                setButtonPanel(newButtonPanel);
099        }// initButton
100
101        public static void main(String[] args) {
102
103                EcoGridServicesController controller = EcoGridServicesController
104                                .getInstance();
105                Vector unSelectedserviceList = controller.getServicesList();
106                // transfer to selectedSerive list(object is SelectedEcoGridService now)
107                Vector selectedServicesLists = SelectableEcoGridService
108                                .transferServiceVectToDefaultSelectedServiceVect(unSelectedserviceList);
109
110                /*
111                 * SearchRegistryResultFrame frame = new
112                 * SearchRegistryResultFrame("SwingApplication", null
113                 * selectedServicesLists);
114                 */
115
116        }// main
117
118}// ServicesListModificationFrame