decodes.dbeditor.DataSourceCombo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opendcs Show documentation
Show all versions of opendcs Show documentation
A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites.
The newest version!
/*
* $Id$
*/
package decodes.dbeditor;
import java.awt.*;
import javax.swing.JComboBox;
import java.util.Iterator;
import decodes.db.Database;
import decodes.db.DataSourceList;
import decodes.db.DataSource;
/**
* This class displays a list of data sources as a combo box. The sources
* are taken from the database.
*/
public class DataSourceCombo extends JComboBox
{
/**
Constructor.
@param includeBlank call with true to allow a blank select at start of
list.
*/
public DataSourceCombo(boolean includeBlank)
{
super();
if (includeBlank)
addItem("");
for(Iterator it =
Database.getDb().dataSourceList.iterator(); it.hasNext(); )
{
DataSource ds = it.next();
addItem(ds.getName());
}
}
/** No-args constructor, equal to this(false) */
public DataSourceCombo()
{
this(false);
}
/**
Sets the current selection.
@param nm the current selection.
*/
public void setSelection(String nm)
{
for(int i=0; i