⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pluginoptionsdialog.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
字号:
/*
 * 04/28/2005
 *
 * PluginOptionsDialog.java - Dialog that displays the options for all plugins
 * in an AbstractPluggableGUIApplication.
 * Copyright (C) 2005 Robert Futrell
 * email@address.com
 * www.website.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.fife.ui.app;

import java.awt.Frame;
import java.util.ArrayList;

import org.fife.ui.OptionsDialog;
import org.fife.ui.OptionsDialogPanel;


/**
 * A dialog that displays all options for all plugins in an
 * <code>AbstractPluggableGUIApplication</code>.
 *
 * @author Robert Futrell
 * @version 0.5
 * @see AbstractPluggableGUIApplication
 */
class PluginOptionsDialog extends OptionsDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1285664130815535183L;

	private AbstractPluggableGUIApplication app;


/*****************************************************************************/


	/**
	 * Constructor.
	 * 
	 * @param app The GUI application.
	 */
	public PluginOptionsDialog(AbstractPluggableGUIApplication app) {

		super(app);
		this.app = app;

		Plugin[] plugins = app.getPlugins();
		int count = plugins.length;
		ArrayList optionsPanelList = new ArrayList();
		for (int i=0; i<count; i++) {
			OptionsDialogPanel panel = plugins[i].getOptionsDialogPanel();
			if (panel!=null)
				optionsPanelList.add(panel);
		}
		count = optionsPanelList.size();
		OptionsDialogPanel[] optionsPanels = new OptionsDialogPanel[count];
		optionsPanels = (OptionsDialogPanel[])optionsPanelList.
											toArray(optionsPanels);
		setOptionsPanels(optionsPanels);
		setLocationRelativeTo(app);

	}


/*****************************************************************************/


	/**
	 * Applies all changes specified in the Options dialog to the plugins of
	 * this application.
	 *
	 * @param owner The application specified in the constructor.
	 */
	public void doApplyImpl(Frame owner) {
		OptionsDialogPanel[] panels = getOptionsDialogPanels();
		int numPanels = panels.length;
		for (int i=0; i<numPanels; i++) {
			((PluginOptionsDialogPanel)panels[i]).updatePlugin();
		}
	}


/*****************************************************************************/


	/**
	 * Initializes all fields/radio buttons/etc. in this options dialog
	 * with their proper states as obtained from the owner of this options
	 * dialog (as passed into the constructor).
 	 *
	 * @see org.fife.ui.OptionsDialog#initialize
	 */
	public void initialize() {
		OptionsDialogPanel[] panels = getOptionsDialogPanels();
		int numPanels = panels.length;
		for (int i=0; i<numPanels; i++) {
			((PluginOptionsDialogPanel)panels[i]).updateGUI();
		}
		setApplyButtonEnabled(false);
	}


/*****************************************************************************/

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -