1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.openide.explorer.propertysheet; 21 22 import java.beans.PropertyEditor; 23 24 /** 25 * An extension interface for property editors that hides 26 * all the necessary communication with the property sheet. ExPropertyEditor 27 * is able to accept an instance of PropertyEnv class - this 28 * environment passes additional information to the editor. 29 * The <code>PropertyEnv</code> instance is typically used 30 * to set the valid/invalid state of the property, and to 31 * retrieve a reference to the Node.Property or PropertyDescriptor 32 * for the property being edited. 33 * @author dstrupl 34 */ 35 public interface ExPropertyEditor extends PropertyEditor { 36 /** 37 * If you want to enable/disable the OK button on the custom 38 * property editor panel you can fire a property change event 39 * with boolean value. You don't have to implement the ExPropertyEditor 40 * interface for this feature to be turned on. 41 * When firing property change event PROP_VALUE_VALID is the name 42 * and an instance of java.lang.Boolean should be passed as a value. 43 */ 44 public static final String PROP_VALUE_VALID = "propertyValueValid"; // NOI18N 45 46 /** 47 * If you want to add custom help ID on the custom property 48 * editor panel you can store its value in PROPERTY_HELP_ID property. 49 */ 50 public static final String PROPERTY_HELP_ID = "helpID"; // NOI18N 51 52 /** 53 * This method is called by the property sheet to pass 54 * the environment to the property editor. The typical use case is for 55 * the ExPropertyEditor to call <code> 56 * env.getFeatureDescriptor().getValue (String key)</code> to retrieve 57 * any hints the Property object may supply regarding how the property 58 * editor should behave (such as providing alternate text representations 59 * of "true" and "false" for a Boolean property 60 * editor).<P>Property editors that support an invalid state (typically 61 * used to disable the OK button in custom editor dialogs) should cache 62 * the env object and update the env's state on calls to <code>setValue()</code>. 63 * <P><strong>Note:</strong> This method may be called more than once 64 * during the lifetime of a property editor. In particular, custom 65 * property editors which want to change the state of the OK button by 66 * calling <code>PropertyEnv.setState(PropertyEnv.STATE_VALID)</code> 67 * should not assume that the instance of PropertyEnv most recently 68 * passed to attachEnv() on the underlying property editor is the same 69 * instance that controls the dialog they are displayed in. Custom 70 * editors which wish to control the state of the OK button should cache 71 * the last-set PropertyEnv at the time they are instantiated. 72 */ 73 public void attachEnv(PropertyEnv env); 74 } 75