|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.xml.tree.settings; import org.openide.ServiceType; import org.openide.options.SystemOption; import org.openide.util.SharedClassObject; import org.openide.util.io.ReaderInputStream; import org.openide.util.HelpCtx; /** Settings for xml module * * @author Libor Kramolis * @version 0.2 */ public class TreeEditSettings extends SystemOption { /** Serial Version UID */ private static final long serialVersionUID = -8031512797757618911L; /** */ private static TreeEditSettings defaultSettings = null; /** */ public static final String PROP_PRINTABLE_VALUE_LENGTH = "printableValueLength"; // NOI18N /** */ private static int printableValueLength = 33; /** */ public static final String PROP_TREE_EXPANSION_LEVEL = "treeExpansionLevel"; // NOI18N /** */ private static int treeExpansionLevel = Integer.parseInt(Util.THIS.getString("PROP_TREE_EXPANSION_DEFAULT")); // NOI18N /** */ public static final String PROP_DEFAULT_NODE_VIEW_TYPE = "defaultNodeViewType"; // NOI18N /** */ private static ServiceType.Handle defaultNodeViewTypeHandler; /** */ public static final String PROP_SHOW_ATTRIBUTE_NODES = "showAttributeNodes"; // NOI18N /** */ private static boolean showAttributeNodes = Boolean.valueOf(Util.THIS.getString("PROP_SHOW_ATTRIBUTE_NODES_DEFAULT")).booleanValue(); // NOI18N; // // init // /** */ public static TreeEditSettings getDefault () { if (defaultSettings == null) defaultSettings = (TreeEditSettings) SharedClassObject.findObject (TreeEditSettings.class, true); return defaultSettings; } // // itself // /** If true then external execution is used */ public String displayName () { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::displayName"); // NOI18N return Util.THIS.getString ("CTL_XML_option"); } // // Printable Value Length // /** */ public int getPrintableValueLength () { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::getPrintableValueLength: " + printableValueLength); // NOI18N return printableValueLength; } /** */ public void setPrintableValueLength (int printableValueLength) { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::setPrintableValueLength: " + printableValueLength); // NOI18N if ( printableValueLength < 0 ) { // throw new IllegalArgumentException(); // http://www.netbeans.org/issues/show_bug.cgi?id=23707 return; // ignore wrong values } int oldPrintableValueLength = this.printableValueLength; this.printableValueLength = printableValueLength; firePropertyChange (PROP_PRINTABLE_VALUE_LENGTH, new Integer (oldPrintableValueLength), new Integer (this.printableValueLength)); } // // Node View Type settings // /** */ private NodeViewType initDefaultNodeViewTypeHandler () { // NodeViewType nodeViewType = (NodeViewType) TopManager.getDefault().getServices().find (NodeViewType.class); NodeViewType nodeViewType = NodeViewType.getValid (new NodeViewType()); if ( nodeViewType != null ) { defaultNodeViewTypeHandler = new ServiceType.Handle (nodeViewType); } return nodeViewType; } /** */ public NodeViewType getDefaultNodeViewType () { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("\n??? TreeEditSettings::getDefaultNodeViewType: " + defaultNodeViewTypeHandler); // NOI18N NodeViewType nodeViewType; if ( defaultNodeViewTypeHandler == null ) { nodeViewType = initDefaultNodeViewTypeHandler(); } else { nodeViewType = (NodeViewType)defaultNodeViewTypeHandler.getServiceType(); if (!!! NodeViewType.isValid (nodeViewType)) { nodeViewType = initDefaultNodeViewTypeHandler(); } } if ( nodeViewType == null ) { nodeViewType = new NodeViewType(); } if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("??? ::getDefaultNodeViewType: RETURN.name " + nodeViewType.getName()); // NOI18N if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("??? ::getDefaultNodeViewType: RETURN " + nodeViewType); // NOI18N return nodeViewType; } /** */ public void setDefaultNodeViewType (NodeViewType nodeView) { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::setDefaultNodeViewType: " + nodeView); // NOI18N NodeViewType oldNodeView = null; if ( defaultNodeViewTypeHandler != null ) { oldNodeView = (NodeViewType)defaultNodeViewTypeHandler.getServiceType(); } defaultNodeViewTypeHandler = new ServiceType.Handle (nodeView); firePropertyChange (PROP_DEFAULT_NODE_VIEW_TYPE, oldNodeView, nodeView); } public HelpCtx getHelpCtx() { return new HelpCtx(TreeEditSettings.class); } /** */ public int getTreeExpansionLevel () { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::getTreeExpansionLevel: " + treeExpansionLevel); // NOI18N return treeExpansionLevel; } /** */ public void setTreeExpansionLevel (int newExpansionLevel) { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::setTreeExpansionLevel: " + newExpansionLevel); // NOI18N if ( newExpansionLevel < 0 ) { // throw new IllegalArgumentException(); // http://www.netbeans.org/issues/show_bug.cgi?id=23707 return; // ignore wrong values } int oldExpansionLevel = this.treeExpansionLevel; this.treeExpansionLevel = newExpansionLevel; firePropertyChange (PROP_TREE_EXPANSION_LEVEL, new Integer (oldExpansionLevel), new Integer (this.treeExpansionLevel)); } /** */ public boolean getShowAttributeNodes () { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::getShowAttributeNodes: " + showAttributeNodes); // NOI18N return showAttributeNodes; } /** */ public void setShowAttributeNodes (boolean newSetting) { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("TreeEditSettings::setShowAttributeNodes: " + newSetting); // NOI18N boolean oldSetting = this.showAttributeNodes; this.showAttributeNodes = newSetting; firePropertyChange ( PROP_SHOW_ATTRIBUTE_NODES, oldSetting ? Boolean.TRUE : Boolean.FALSE, newSetting ? Boolean.TRUE : Boolean.FALSE ); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.