xmlproperties.java
来自「JavaExplorer是一个独立于平台的浏览器」· Java 代码 · 共 238 行
JAVA
238 行
/** * File and FTP Explorer * Copyright 2003 * BOESCH Vincent * * 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 (at your option) 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 javaexplorer.util;import objectxml.*;import javaexplorer.util.ftp.*;import javaexplorer.util.laf.LookAndFeelChooser;import javaexplorer.util.options.*;import javaexplorer.util.registry.*;import javaexplorer.util.shortcut.*;/** * Classe permettant d'閏rire l'ensemble des propri閠閟 du projet dans le fichier Jexp_properties.xml * <p>Title: JExp</p> * <p>Description: File, FTP Explorer</p> * <p>Copyright: 2003</p> * <p>Company: N/A</p> * @author BOESCH Vincent * @version 4.4 */public class XMLProperties implements Xmlizable { private javaexplorer.util.options.Options options; private javaexplorer.util.options.HttpOptions hoptions; private javaexplorer.util.registry.Registry registry; private javaexplorer.util.shortcut.ShortcutContainer shortcuts; private javaexplorer.util.ftp.FtpContainer ftps; private LookAndFeelChooser chooser; public XMLProperties() { //Valeurs par d閒aut pour les diff閞ents param鑤res options = Options.getOptions(); hoptions = HttpOptions.getOptions(); registry = Registry.getRegistry(); chooser = LookAndFeelChooser.getChooser(); shortcuts = new ShortcutContainer(); shortcuts.setTitle("Shortcut Manager"); ftps = new FtpContainer(); ftps.setTitle("Ftp Manager"); } public XMLContent writeXMLProperties() { XMLContent root = new XMLContent("ClassName", getClass().getName()); XMLContent prop = null; //Pas de parametre constructeur //Propri閠閟 XMLContent content = new XMLContent("Properties"); //Ajout des options prop = new XMLContent("Options"); prop.add(options.writeXMLProperties()); content.add(prop); //Ajout des options prop = new XMLContent("HttpOptions"); prop.add(hoptions.writeXMLProperties()); content.add(prop); //Ajout registry prop = new XMLContent("Registry"); prop.add(registry.writeXMLProperties()); content.add(prop); //Ajout des Sites FTP prop = new XMLContent("Ftp"); prop.add(ftps.writeXMLProperties()); content.add(prop); //Ajout des Shortcuts prop = new XMLContent("Shortcut"); prop.add(shortcuts.writeXMLProperties()); content.add(prop); //Ajout du Chooser L&F prop = new XMLContent("LookAndFeelChooser"); prop.add(chooser.writeXMLProperties()); content.add(prop); root.add(content); return root; } public void readXMLProperties(XMLContent content) { ObjectXml ox = new ObjectXml(); //Lecture des propri閠閟 if (content == null) { return; } XMLContent prop = null; try { prop = content.getChild("Options"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Options options = (Options) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } try { prop = content.getChild("HttpOptions"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Options hoptions = (HttpOptions) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } try { prop = content.getChild("Registry"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Registry registry = (Registry) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } try { prop = content.getChild("Ftp"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Ftp ftps = (FtpContainer) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } try { prop = content.getChild("Shortcut"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Shorcuts shortcuts = (ShortcutContainer) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } try { prop = content.getChild("LookAndFeelChooser"); if (prop != null) { //On r閏up鑢e le premier fils qui est la valeur Shorcuts chooser = (LookAndFeelChooser) (ox.xmlContentToXmlizable((prop.getChildren())[0])); } } catch (Exception e) { } } public void setOptions(javaexplorer.util.options.Options newOptions) { options = newOptions; } public javaexplorer.util.options.Options getOptions() { return options; } public void setRegistry(javaexplorer.util.registry.Registry newRegistry) { registry = newRegistry; } public javaexplorer.util.registry.Registry getRegistry() { return registry; } public void setShortcuts( javaexplorer.util.shortcut.ShortcutContainer newShortcuts) { shortcuts = newShortcuts; } public javaexplorer.util.shortcut.ShortcutContainer getShortcuts() { return shortcuts; } public void setFtps(javaexplorer.util.ftp.FtpContainer newFtps) { ftps = newFtps; } public javaexplorer.util.ftp.FtpContainer getFtps() { return ftps; } /** * @return */ public LookAndFeelChooser getChooser() { return chooser; } /** * @param chooser */ public void setChooser(LookAndFeelChooser chooser) { this.chooser = chooser; } /** * @return */ public javaexplorer.util.options.HttpOptions getHttpOptions() { return hoptions; } /** * @param options */ public void setHttpOptions(javaexplorer.util.options.HttpOptions options) { hoptions = options; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?