KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > explorer > propertysheet > PropertyDisplayer_Editable


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  * PropertyDisplayer_Editable.java
21  * Refactored from PropertyDisplayer.Editable to keep the interface private.
22  * Created on December 13, 2003, 7:17 PM
23  */

24 package org.openide.explorer.propertysheet;
25
26 import java.awt.event.ActionListener JavaDoc;
27
28 import javax.swing.event.ChangeListener JavaDoc;
29
30
31 /** Basic definition of a property displayer which allows editing.
32  * @author Tim Boudreau */

33 interface PropertyDisplayer_Editable extends PropertyDisplayer {
34     /** Set the enabled state of the component, determining if it can
35      * be edited or not. Clients should use this method, not the
36      * setEnabled() method on the result of getComponent() to ensure
37      * the enabled state is correctly set for the editor - in the case
38      * of the current implementation for custom editors, a call to this
39      * method will disable all children of the custom editor */

40     public void setEnabled(boolean enabled);
41
42     /** Reset the value to that of the property, discarding any edits in
43      * progress */

44     public void reset();
45
46     /** Determine if the value has been modified by the user */
47     public boolean isValueModified();
48
49     /** Determine if the modified value can be written to the property
50      * without errors. This method will return a localized message
51      * describing the problem, or null if the value is legal */

52     public String JavaDoc isModifiedValueLegal();
53
54     /** Writes the edited value to the property. If the update policy
55      * is UPDATE_ON_EXPLICIT_REQUEST, this method will throw an exception
56      * if the value cannot be written; for other update policies, a dialog
57      * will be shown to the user if there is a problem */

58     public boolean commit() throws IllegalArgumentException JavaDoc;
59
60     /** Get the value the user has entered. This generally follows the
61      * contract of InplaceEditor.getValue() - it may either return a
62      * String (which may be compatible with the property's property editor's
63      * setAsText()) method, or it may return an object directly writable
64      * to the property. */

65     public Object JavaDoc getEnteredValue();
66
67     /** Set the value to be displayed */
68     public void setEnteredValue(Object JavaDoc o);
69
70     /** Get the update policy for the editor. */
71     public int getUpdatePolicy();
72
73     /** Set the update policy for the editor. Not all possible states
74      * are meaningful to all possible implementations; in particular,
75      * it is impossible to determine when a custom editor will choose to
76      * write its value to the property. Inline editors have more predictable
77      * semantics in this regard. */

78     public void setUpdatePolicy(int i);
79
80     /** Set the action command to be fired if the user performs an action*/
81     public void setActionCommand(String JavaDoc val);
82
83     /** Get the action command to be fired if the user performs an action*/
84     public String JavaDoc getActionCommand();
85
86     /** Add an action listener. Implementations should follow the general
87      * contract of JTextField - if an action listener is not present,
88      * performing an action with the Enter or Esc keys should close any
89      * parent dialog */

90     public void addActionListener(ActionListener JavaDoc al);
91
92     /** Remove an action listener */
93     public void removeActionListener(ActionListener JavaDoc al);
94
95     /** Add a change listener. State changes are to be fired on either
96      * changes in the writability of the entered value, or committing of
97      * the value to the property */

98     public void addChangeListener(ChangeListener JavaDoc cl);
99
100     /** Remove a change listener */
101     public void removeChangeListener(ChangeListener JavaDoc cl);
102
103     //XXX remove the propertyEnv method if this interface is to be made public -
104
//it's just needed to support PropertyPanel.getPropertyEnv - it can be
105
//done by reflection instead.
106
public PropertyEnv getPropertyEnv();
107 }
108
Popular Tags