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

📄 options.java

📁 java写的多功能文件编辑器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Options.java - Options for JBrowse * * Copyright (c) 1999 George Latkiewicz	(georgel@arvotek.net) * * 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. */import javax.swing.event.*;//=============================================================================public class Options{	private boolean showStatusBar;	private Filter filterOpt;   // (WHAT to display)	private Display displayOpt;	// (HOW  to display)	private ChangeListener listener;	public Options()	{		filterOpt  = new Filter();		displayOpt = new Display();	} // Options(): <init>	public ChangeListener getListener() { return listener; }	//-------------------------------------------------------------------------	/**	 * The method that sets the option object's state to reflect the values	 * specified by the passed PropertyAccessor.	 */	public void load(PropertyAccessor props)	{		// General Options		setShowStatusBar(				!"off".equals(props.getProperty("jbrowse.showStatusBar")));		// Filter Options		filterOpt.setShowAttributes(				"on".equals(props.getProperty("jbrowse.showAttr")));		filterOpt.setShowPrimitives(				"on".equals(props.getProperty("jbrowse.showPrimAttr")));		filterOpt.setShowGeneralizations(				"on".equals(props.getProperty("jbrowse.showGeneralizations")));		filterOpt.setShowThrows(				"on".equals(props.getProperty("jbrowse.showThrows")));		int topLevelVisIndex;		try {			topLevelVisIndex = Integer.parseInt(					props.getProperty("jbrowse.topLevelVisIndex"));		} catch(NumberFormatException nf) {			topLevelVisIndex = RWModifier.TOPLEVEL_VIS_PACKAGE;		}		if (topLevelVisIndex < RWModifier.TOPLEVEL_VIS_PACKAGE				|| topLevelVisIndex > RWModifier.TOPLEVEL_VIS_PUBLIC ) {			topLevelVisIndex = RWModifier.TOPLEVEL_VIS_PACKAGE;		}		filterOpt.setTopLevelVisIndex( topLevelVisIndex );		int memberVisIndex;		try {			memberVisIndex = Integer.parseInt(					props.getProperty("jbrowse.memberVisIndex"));		} catch(NumberFormatException nf) {			memberVisIndex = RWModifier.MEMBER_VIS_PRIVATE;		}		if (memberVisIndex < RWModifier.MEMBER_VIS_PRIVATE				|| memberVisIndex > RWModifier.MEMBER_VIS_PUBLIC ) {			memberVisIndex = RWModifier.MEMBER_VIS_PRIVATE;		}		filterOpt.setMemberVisIndex( memberVisIndex );		// Display Options		displayOpt.setShowArguments(				"on".equals(props.getProperty("jbrowse.showArgs")));		displayOpt.setShowArgumentNames(				"on".equals(props.getProperty("jbrowse.showArgNames")));		displayOpt.setShowNestedName(				"on".equals(props.getProperty("jbrowse.showNestedName")));		displayOpt.setShowIconKeywords(				"on".equals(props.getProperty("jbrowse.showIconKeywords")));		displayOpt.setShowMiscMod(				"on".equals(props.getProperty("jbrowse.showMiscMod")));		displayOpt.setAlphaSort(				"on".equals(props.getProperty("jbrowse.alphaSortMethods")));		displayOpt.setShowLineNum(				"on".equals(props.getProperty("jbrowse.showLineNums")));		int styleIndex;		try		{			styleIndex = Integer.parseInt(					props.getProperty("jbrowse.displayStyle"));		}		catch(NumberFormatException nf)		{			styleIndex = Options.Display.STYLE_UML;		}		if (styleIndex < Options.Display.STYLE_FIRST				|| styleIndex > Options.Display.STYLE_LAST ) {			styleIndex = Options.Display.STYLE_UML;		}		displayOpt.setStyleIndex( styleIndex );		displayOpt.setVisSymbols(				"on".equals(props.getProperty("jbrowse.custVisAsSymbol")));		displayOpt.setAbstractItalic(				"on".equals(props.getProperty("jbrowse.custAbsAsItalic")));		displayOpt.setStaticUlined(				"on".equals(props.getProperty("jbrowse.custStaAsUlined")));		displayOpt.setTypeIsSuffixed(				"on".equals(props.getProperty("jbrowse.custTypeIsSuffixed")));	} // load(PropertyAccessor props): void	//-------------------------------------------------------------------------	/**	 * The method that sets the passed PropertyAccessor's state to reflect	 * the current state of this Options object.	 */	public void save(PropertyAccessor props)	{		// General Options		//----------------		props.setProperty( "jbrowse.showStatusBar",				getShowStatusBar() ? "on" : "off" );		// Filter Options		//---------------		props.setProperty( "jbrowse.showAttr",				filterOpt.getShowAttributes() ? "on" : "off" );		props.setProperty( "jbrowse.showPrimAttr",				filterOpt.getShowPrimitives() ? "on" : "off" );		props.setProperty( "jbrowse.showGeneralizations",				filterOpt.getShowGeneralizations() ? "on" : "off" );		props.setProperty( "jbrowse.showThrows",				filterOpt.getShowThrows() ? "on" : "off" );		/* Visibility Level */		props.setProperty( "jbrowse.topLevelVisIndex",				String.valueOf(filterOpt.getTopLevelVisIndex()) );		props.setProperty( "jbrowse.memberVisIndex",				String.valueOf(filterOpt.getMemberVisIndex()) );		// Display Options		//----------------		props.setProperty( "jbrowse.showArgs",				displayOpt.getShowArguments() ? "on" : "off" );		props.setProperty( "jbrowse.showArgNames",				displayOpt.getShowArgumentNames() ? "on" : "off" );		props.setProperty( "jbrowse.showNestedName",				displayOpt.getShowNestedName() ? "on" : "off" );		props.setProperty( "jbrowse.showIconKeywords",				displayOpt.getShowIconKeywords() ? "on" : "off" );		props.setProperty( "jbrowse.showMiscMod",				displayOpt.getShowMiscMod() ? "on" : "off" );		props.setProperty( "jbrowse.alphaSortMethods",				displayOpt.getAlphaSort() ? "on" : "off" );		props.setProperty( "jbrowse.showLineNums",				displayOpt.getShowLineNum() ? "on" : "off" );		/* Display Style */		props.setProperty("jbrowse.displayStyle",				String.valueOf(displayOpt.getStyleIndex()) );		/* Custom Style Options */		props.setProperty("jbrowse.custVisAsSymbol",				displayOpt.getVisSymbols() ? "on" : "off" );		props.setProperty("jbrowse.custAbsAsItalic",				displayOpt.getAbstractItalic() ? "on" : "off" );		props.setProperty("jbrowse.custStaAsUlined",				displayOpt.getStaticUlined() ? "on" : "off" );		props.setProperty("jbrowse.custTypeIsSuffixed",				displayOpt.getTypeIsSuffixed() ? "on" : "off" );	} // save(PropertyAccessor props): void	// Accessor methods	//-------------------------------------------------------------------------	public final boolean getShowStatusBar()  { return showStatusBar; }	public final void setShowStatusBar(boolean flag) {		showStatusBar = flag;	}	public final Filter  getFilterOptions()  { return filterOpt; }	public final Display getDisplayOptions() { return displayOpt; }	//-------------------------------------------------------------------------	/**	 * This is the method that is called in order to associate the JBrowse	 * session's ChangeListener with this Option object.	 */	public void addChangeListener(ChangeListener listener)	{		this.listener = listener; // there can only be one at this time	}	// Other Object methods	//-------------------------------------------------------------------------	public final String toString()	{		return  filterOpt.toString() + "\n"				+ displayOpt.toString();	}	//=========================================================================	public static class Display implements DisplayIro	{		// Display Style options (HOW)		private boolean showArguments;		private boolean showArgumentNames;		private boolean showNestedName;		private boolean showIconKeywords;		private boolean showMiscMod;		private boolean alphaSort;		private boolean showLineNum;		private int styleIndex = STYLE_UML;		private boolean visSymbols;		private boolean abstractItalic;		private boolean staticUlined;		private boolean typeIsSuffixed;		// Accessor methods

⌨️ 快捷键说明

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