|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.opensha.commons.param.editor.AbstractParameterEditorOld
@Deprecated public abstract class AbstractParameterEditorOld
Title: ParameterEditor
Description: This is the base Editor class that all Parameter GUI Editors extend to inherit the common functionality. This editor extends JPanel that uses a TitledBorder to display the name of the Parameter, and has an addWidget function that all subclasses will extend to add different types of text fields or picklists.
All the functionality of the Editors are in this class. The only thing that subclasses have to deal with is setting the specific widget for the subclass, and how to handle key and focus events on this widget.
The types of widgets added to edit the parameter value are JTextField, NumericTextField, IntegerTextField, or JComboBox for contrained values.
Note: There are many static constants such as Colors, fonts, etc. Subclasses should use these static instances. It will cut down on the number of classes instantiated, helps with performance, and maintains a common look and feel for this parameter framework. Each static field will not be commented, they should be self explainatory. You need to understand java Swing to understand all these constants. See each component's Javadoc for further documentation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected Border |
border1
Deprecated. |
protected static String |
C
Deprecated. Class name for debugging. |
protected boolean |
catchConstraint
Deprecated. Flag whether to catch errors when constraint error thrown. |
protected static GridBagConstraints |
COMBO_WIDGET_GBC
Deprecated. |
protected static Border |
CONST_BORDER
Deprecated. |
protected static boolean |
D
Deprecated. If true print out debug statements. |
protected static String |
DATA_TEXT
Deprecated. Default text for text field |
static Font |
DEFAULT_FONT
Deprecated. |
static Font |
DEFAULT_LABEL_FONT
Deprecated. |
protected static String |
EMPTY
Deprecated. |
protected static Border |
ETCHED
Deprecated. |
protected static Insets |
FIVE_FIVE_INSETS
Deprecated. |
protected static Insets |
FIVE_INSETS
Deprecated. |
protected static Border |
FOCUS_BORDER
Deprecated. |
protected boolean |
focusEnabled
Deprecated. |
protected boolean |
focusLostProcessing
Deprecated. Flag to indicate that this widget is processing a focus lost event |
static Color |
FORE_COLOR
Deprecated. |
protected static GridBagLayout |
GBL
Deprecated. |
protected static Dimension |
JCOMBO_DIM
Deprecated. |
protected static Font |
JCOMBO_FONT
Deprecated. |
protected static Dimension |
JLIST_DIM
Deprecated. |
protected boolean |
keyTypeProcessing
Deprecated. Flag to indicate that this widget is processing a key typed event |
protected static Dimension |
LABEL_DIM
Deprecated. |
protected static Dimension |
LABEL_PANEL_DIM
Deprecated. |
protected static String |
LABEL_TEXT
Deprecated. Default string for parameter title |
protected JPanel |
labelPanel
Deprecated. |
protected Parameter |
model
Deprecated. The internal parameter that this Editor is editing |
protected JLabel |
nameLabel
Deprecated. |
protected static GridBagConstraints |
OUTER_PANEL_GBC
Deprecated. |
protected JPanel |
outerPanel
Deprecated. |
protected static Color |
STRING_BACK_COLOR
Deprecated. |
protected TitledBorder |
titledBorder1
Deprecated. This border displays the name of the parameter. |
protected JComponent |
valueEditor
Deprecated. This is a VERY IMPORTANT component to understand this framework. |
protected static GridBagConstraints |
WIDGET_GBC
Deprecated. |
protected static GridBagConstraints |
WIDGET_PANEL_GBC
Deprecated. |
protected JPanel |
widgetPanel
Deprecated. |
protected static Dimension |
WIGET_PANEL_DIM
Deprecated. |
protected static Insets |
ZERO_INSETS
Deprecated. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
AbstractParameterEditorOld()
Deprecated. Constructor for the ParameterEditor hat just calls jbinit(). |
|
AbstractParameterEditorOld(Parameter model)
Deprecated. Constructor for the ParameterEditor that set's the parameter then calls jbInit(). |
|
| Method Summary | |
|---|---|
protected void |
addWidget()
Deprecated. VERY IMPORTANT function to understand this framework. |
void |
focusGained(FocusEvent e)
Deprecated. Called when this editor gains the GUI focus for keyboard and mouse events. |
void |
focusLost(FocusEvent e)
Deprecated. Called when this editor looses the GUI focus for keyboard and mouse events. |
JPanel |
getComponent()
Deprecated. |
JPanel |
getOuterPanel()
Deprecated. return the JPanel This is needed so that we can set the border or font differently This function is called from IMR gui Bean and ERF Gui Bean |
Parameter |
getParameter()
Deprecated. Returns the parameter this editor is pointing to. |
Object |
getValue()
Deprecated. Proxy call to the internal parameter to return it's value. |
JComponent |
getValueEditor()
Deprecated. Exposes the underlying value editor |
boolean |
isFocusEnabled()
Deprecated. Returns the focusEnabled boolean indicating this is the GUI componet with the current focus |
protected void |
jbInit()
Deprecated. Main GUI Initialization point. |
void |
keyPressed(KeyEvent e)
Deprecated. Called when a key is pressed in this editor. |
void |
keyReleased(KeyEvent e)
Deprecated. Called when a key was pressed and is now released in this editor. |
void |
keyTyped(KeyEvent e)
Deprecated. Called when a key is typed in this editor. |
static JLabel |
makeConstantEditor(String label)
Deprecated. Not sure what this is used for, but makes a JLabel with default values and sets the text to the passed in String. |
void |
refreshParamEditor()
Deprecated. Called when the parameter has changed independently from the editor, such as with the ParameterWarningListener. |
protected void |
removeWidget()
Deprecated. Removes the Parameter editor component from this editor. |
void |
setEditorBorder(Border b)
Deprecated. |
void |
setEnabled(boolean isEnabled)
Deprecated. It enables/disables the editor according to whether user is allowed to fill in the values. |
void |
setFocusEnabled(boolean newFocusEnabled)
Deprecated. Sets the focusEnabled boolean indicating this is the GUI componet with the current focus |
protected void |
setNameLabelToolTip(String str)
Deprecated. The tooltip for the name label ( titled border ) can add additional informartion about the Parameter. |
void |
setParameter(Parameter model)
Deprecated. Set's the parameter to be edited by this editor. |
void |
setParameterInEditor(Parameter model)
Deprecated. Set's the parameter to be edited by this editor. |
void |
setValue(Object value)
Deprecated. Needs to be called by subclasses when editable widget field changed. |
void |
setWidgetBorder(Border b)
Deprecated. Allows the GUI to set different borders to this editor for customization |
protected void |
setWidgetObject(String name,
Object obj)
Deprecated. VERY IMPORTANT function to understand this framework. |
void |
unableToSetValue(Object value)
Deprecated. Needs to be called by subclasses when editable widget field change fails due to constraint problems. |
protected void |
updateNameLabel(String label)
Deprecated. Updates the name label (titled border ) of this editor with a new parameter name. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.opensha.commons.param.editor.ParameterEditor |
|---|
isVisible, setVisible |
| Field Detail |
|---|
protected static final String C
protected static final boolean D
protected static final String DATA_TEXT
protected static final String LABEL_TEXT
protected static final String EMPTY
public static Color FORE_COLOR
protected static Color STRING_BACK_COLOR
protected static final Dimension LABEL_DIM
protected static final Dimension LABEL_PANEL_DIM
protected static final Dimension WIGET_PANEL_DIM
protected static final Dimension JCOMBO_DIM
protected static final Dimension JLIST_DIM
protected static final GridBagLayout GBL
protected static final Insets ZERO_INSETS
protected static final Insets FIVE_INSETS
protected static final Insets FIVE_FIVE_INSETS
protected static Font JCOMBO_FONT
public static Font DEFAULT_LABEL_FONT
public static Font DEFAULT_FONT
protected static final Border CONST_BORDER
protected static final Border FOCUS_BORDER
protected static final Border ETCHED
protected static final GridBagConstraints OUTER_PANEL_GBC
protected static final GridBagConstraints WIDGET_PANEL_GBC
protected static final GridBagConstraints WIDGET_GBC
protected static final GridBagConstraints COMBO_WIDGET_GBC
protected JPanel outerPanel
protected JPanel labelPanel
protected JPanel widgetPanel
protected JLabel nameLabel
protected boolean focusEnabled
protected Border border1
protected TitledBorder titledBorder1
protected JComponent valueEditor
protected Parameter model
protected boolean catchConstraint
protected boolean keyTypeProcessing
protected boolean focusLostProcessing
| Constructor Detail |
|---|
public AbstractParameterEditorOld()
public AbstractParameterEditorOld(Parameter model)
| Method Detail |
|---|
public void setValue(Object value)
throws ConstraintException
setValue in interface ParameterEditorvalue - The new value to set in the parameter.
ConstraintException - Thrown if the parameter rejects the new value.public void setParameterInEditor(Parameter model)
model - : Parameterpublic void setParameter(Parameter model)
setParameter in interface ParameterEditor
protected void setWidgetObject(String name,
Object obj)
protected void setNameLabelToolTip(String str)
public void setFocusEnabled(boolean newFocusEnabled)
setFocusEnabled in interface ParameterEditorpublic JComponent getValueEditor()
public Object getValue()
getValue in interface ParameterEditorpublic Parameter getParameter()
getParameter in interface ParameterEditorpublic boolean isFocusEnabled()
isFocusEnabled in interface ParameterEditorpublic void refreshParamEditor()
refreshParamEditor in interface ParameterEditor
public void unableToSetValue(Object value)
throws ConstraintException
unableToSetValue in interface ParameterEditorConstraintExceptionpublic static JLabel makeConstantEditor(String label)
protected void jbInit()
throws Exception
Exceptionprotected void removeWidget()
protected void addWidget()
This base class sets the widget to a simple JTextField for an example of usage. This allows this editor to be able to edit an unconstrained String Parameter. No subclass is needed for that type of parameter.
Note: most subclasses add more complexity to this component. For example, the DoubleParameterEditor makes this widget componet an NumericTextField that only accepts numeric characters, such as digets and a period for the decimal place.
public void setWidgetBorder(Border b)
protected void updateNameLabel(String label)
public void focusGained(FocusEvent e)
focusGained in interface FocusListenerpublic void focusLost(FocusEvent e)
focusLost in interface FocusListenerpublic void keyTyped(KeyEvent e)
keyTyped in interface KeyListenerpublic void keyPressed(KeyEvent e)
keyPressed in interface KeyListenerpublic void keyReleased(KeyEvent e)
keyReleased in interface KeyListenerpublic void setEnabled(boolean isEnabled)
setEnabled in interface ParameterEditorsetEnabled in class JComponentpublic JPanel getOuterPanel()
public JPanel getComponent()
getComponent in interface ParameterEditorpublic void setEditorBorder(Border b)
setEditorBorder in interface ParameterEditor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||