All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ilex.gui.EditPropsAction Maven / Gradle / Ivy

Go to download

A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites.

The newest version!
/*
*  $Id$
*
*  $Source$
*
*  $State$
*
*  $Log$
*  Revision 1.1  2008/04/04 18:21:08  cvs
*  Added legacy code to repository
*
*  Revision 1.11  2008/01/21 02:37:21  mmaloney
*  modified files for internationalization
*
*  Revision 1.9  2004/08/30 14:50:18  mjmaloney
*  Javadocs
*
*  Revision 1.8  2002/05/03 18:54:50  mjmaloney
*  For ClientAppSettings, added constructor for NOT including the CORBA
*  options. This is used by non-corba apps like the MessageBrowser.
*  for gui/EditProperties, implemented register method that causes pull-
*  down menus to be displayed rather than JTextField.
*
*  Revision 1.7  2002/04/30 22:12:58  mjmaloney
*  Added registerEditor method so that various properties could use different
*  kinds of editors rather than JTextField.
*
*  Revision 1.6  2001/03/03 03:15:29  mike
*  GUI mods for 3.2
*
*  Revision 1.5  2000/10/09 16:43:21  mike
*  dev
*
*  Revision 1.4  2000/06/07 13:49:09  mike
*  Removed diagnostics
*
*  Revision 1.3  2000/05/31 16:00:21  mike
*  Implemented Save button in properties dialog.
*
*  Revision 1.2  2000/03/28 00:43:18  mike
*  dev
*
*  Revision 1.1  2000/03/25 22:03:25  mike
*  dev
*
*/
package ilex.gui;

import javax.swing.text.JTextComponent;

import java.util.ResourceBundle;
import java.util.Vector;
import java.util.Properties;
import java.util.Enumeration;
import java.util.HashMap;
import java.awt.*;
import java.io.IOException;
import java.awt.event.*;
import javax.swing.*;

/**
Action for editing properties
This class was designed for the LRGS GUI. The application's properties are
kept in a big Properties set. Each screen wants to provide an editor screen
of just its properties, identified by a prefix.
Example, the MessageBrowser just shows propeties that start with the
prefixes "General" or "MessageBrowser".
*/
public class EditPropsAction extends AbstractAction
{
	private static ResourceBundle labels = MenuFrame.getLabels();
	/** The owning frame */
	JFrame parent;
	/**  prefixes to edit */
	String[] prefixes;
	/** appears in the dialog */
	String screenname;
	static HashMap editors = new HashMap();

	/**
	* Registers an editor for a particular property. 
	* Example: if this is a boolean property, the editor might be a combo
	* box with values "true" and "false".
	* @param propName the property name
	* @param editor the GUI editor component
	*/
	public static void registerEditor( String propName, JComponent editor )
	{
		editors.put(propName.toLowerCase(), editor);
	}

	/**
	* Constructor.
	* @param parent the owning frame
	* @param screenname appears in the dialog
	* @param prefixes list of prefixes to include in the dialog
	*/
	public EditPropsAction( JFrame parent, String screenname, String[] prefixes )
	{
		//super("Properties");
		super(labels.getString("EditPropsAction.properties"));
		this.parent = parent;
		this.screenname = screenname;
		if (prefixes == null)
			this.prefixes = null;
		else
		{
			this.prefixes = new String[prefixes.length];
			for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy