Source code: javax/ide/view/Viewable.java
1 package javax.ide.view;
2
3 import java.beans.PropertyChangeListener;
4 import javax.ide.util.IconDescription;
5
6 /**
7 * <code>Viewable</code>s are objects that map directly to visible
8 * GUI elements that users can select.
9 */
10 public interface Viewable
11 {
12 /**
13 * Identifies the bound property 'label'.
14 */
15 public static final String PROP_LABEL = "label";
16
17 /**
18 * Identifies the bound property 'iconPath'.
19 */
20 public static final String PROP_ICON_PATH = "iconPath";
21
22 /**
23 * Identifies the bound property 'visible'.
24 */
25 public static final String PROP_VISIBLE = "visible";
26
27 /**
28 * Get the object visible state.
29 *
30 * @return The command visible state.
31 */
32 public boolean isVisible();
33
34 /**
35 * Returns a short label that can be displayed to the user.
36 * Generally, the value of the returned {@link String} is considered
37 * translatable and should therefore be placed in an appropriate
38 * resource file. When possible, the returned label should be
39 * reasonably short enough to show in the navigator or explorer
40 * windows but long enough to clearly identify and distinguish the
41 * <CODE>Viewable</CODE>.
42 *
43 * @return a short descriptive label of the <CODE>Viewable</CODE>
44 * that can be shown to the user.
45 */
46 public String getLabel();
47
48 /**
49 * Returns the tool tip text to show when the mouse pointer pauses
50 * over a UI component that represents this <CODE>Viewable</CODE>.
51 *
52 * @return the tooltip to show when the mouse pointer pauses over a
53 * UI component that represents this <CODE>Viewable</CODE>.
54 */
55 public String getToolTip();
56
57 /**
58 * Gets a relative path to the icon. Generally, the is considered
59 * translatable, therefore, the path value be placed in an appropriate
60 * resource file. The path must be relative the Viewable implementation
61 * class file location or the resource file location if one is provided.
62 *
63 * @return The icon relative path.
64 */
65 public IconDescription getIcon();
66
67 /**
68 * Returns the label. This overrides the <code>toString</code> method in
69 * <code>java.lang.Object</code>. <p>
70 * Implementors of the <code>Viewable</code> interface should
71 * override this as appropriate. The default implementation is
72 * the same as <code>getLabel()</code>
73 *
74 * @return A short label describing this <code>Viewable</code>.
75 *
76 * @see java.lang.Object#toString()
77 * @see #getLabel()
78 */
79 public String toString();
80
81 /**
82 * Add a {@link PropertyChangeListener} to the listener list.
83 * A <code>PropertyChangeEvent</code> will be fired in response to setting
84 * a bound property.
85 * @param listener A {@link PropertyChangeListener}.
86 */
87 public void addPropertyChangeListener( PropertyChangeListener listener );
88
89 /**
90 * Removes a {@link PropertyChangeListener} from the listener list.
91 * @param listener A {@link PropertyChangeListener}.
92 */
93 public void removePropertyChangeListener( PropertyChangeListener listener );
94 }