KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > util > gui > propedit > SpacerEditorPane


1 package net.suberic.util.gui.propedit;
2 import javax.swing.*;
3 import java.awt.Component JavaDoc;
4 import java.awt.Dimension JavaDoc;
5 import net.suberic.util.*;
6
7 /**
8  * An EditorPane which actually just acts as a strut.
9  *
10  */

11 public class SpacerEditorPane extends SwingPropertyEditor {
12   protected Component JavaDoc strut = null;
13
14   /**
15    * @param propertyName The property to be edited.
16    * @param template The property that will define the layout of the
17    * editor.
18    * @param manager The PropertyEditorManager that will manage the
19    * changes.
20    */

21   public void configureEditor(String JavaDoc propertyName, String JavaDoc template, String JavaDoc propertyBaseName, PropertyEditorManager newManager) {
22     configureBasic(propertyName, template, propertyBaseName, newManager);
23     int height = 10;
24     try {
25       height = Integer.parseInt(manager.getProperty(template + ".height", "10"));
26     } catch (Exception JavaDoc e) {
27
28     }
29     strut = Box.createVerticalStrut(height);
30     this.add(strut);
31     this.setMinimumSize(new Dimension JavaDoc(1, height));
32     this.setPreferredSize(new Dimension JavaDoc(10, height));
33     this.setMaximumSize(new Dimension JavaDoc(Integer.MAX_VALUE, height));
34
35   }
36
37   /**
38    * This writes the currently configured value in the PropertyEditorUI
39    * to the source VariableBundle.
40    *
41    * A no-op in this case.
42    */

43   public void setValue() {
44
45   }
46   public void validateProperty() {
47
48   }
49
50   /**
51    * Returns the current values of the edited properties as a
52    * java.util.Properties object.
53    *
54    * This implementation returns an empty array.
55    */

56   public java.util.Properties JavaDoc getValue() {
57     java.util.Properties JavaDoc retProps = new java.util.Properties JavaDoc();
58
59     return retProps;
60   }
61
62   /**
63    * This resets the editor to the original (or latest set, if setValue()
64    * has been called) value of the edited property.
65    */

66   public void resetDefaultValue() {
67   }
68
69   /**
70    * Selects the given value.
71    */

72   public void setSelectedValue(String JavaDoc newValue) {
73   }
74
75   /**
76    * Returns whether or not the current list selection has changed from
77    * the last save.
78    */

79   public boolean isChanged() {
80     return false;
81   }
82
83   /**
84    * Gets the parent PropertyEditorPane for the given component.
85    */

86   public PropertyEditorPane getPropertyEditorPane() {
87     return getPropertyEditorPane(this);
88   }
89
90   /**
91    * Returns the display value for this property.
92    */

93   public String JavaDoc getDisplayValue() {
94     return getProperty();
95   }
96
97   /**
98    * Updates the editorEnabled value. A no-op in this case.
99    */

100   protected void updateEditorEnabled() {
101
102   }
103
104 }
105
Popular Tags