org.openbp.jaspira.propertybrowser.editor.standard
Class StringEditor

java.lang.Object
  extended by org.openbp.jaspira.propertybrowser.editor.AbstractPropertyEditor
      extended by org.openbp.jaspira.propertybrowser.editor.standard.StringEditor
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.lang.Cloneable, java.util.EventListener, javax.swing.event.DocumentListener, Copyable, PropertyEditor
Direct Known Subclasses:
ComponentSelectionEditor, IntegerEditor, PathEditor

public class StringEditor
extends AbstractPropertyEditor
implements javax.swing.event.DocumentListener

A property editor for string values used by the property browser. By default, components returned to the property browser for both editing and displaying are both induvidual JTextFields, however, should the porperty be read only, then the display component will be a JLable, and the editor component will return a null.

Author:
Andreas Putz

Field Summary
protected  javax.swing.JTextField textField
          Text field as property editor component.
 
Fields inherited from class org.openbp.jaspira.propertybrowser.editor.AbstractPropertyEditor
component, listener, object, owner, parameterParser, params, propertyBrowser, propertyName, readonly, validator, value, valueChanged, valueLoaded
 
Fields inherited from interface org.openbp.common.generic.Copyable
COPY_DEEP, COPY_FIRST_LEVEL, COPY_SHALLOW
 
Constructor Summary
StringEditor()
          Default constructor.
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that an attribute or set of attributes changed.
 void createComponent()
          Creates the editor component of the property editor.
 java.lang.Object getComponentValue()
          Gets the current editor component value.
 void highlight(boolean on)
          Highlights the content of the component.
 void insertUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that there was an insert into the document.
 void keyPressed(java.awt.event.KeyEvent e)
          Invoked when a key has been pressed.
 void removeUpdate(javax.swing.event.DocumentEvent e)
          Gives notification that a portion of the document has been removed.
 void setComponentValue()
          Sets the display component value.
 
Methods inherited from class org.openbp.jaspira.propertybrowser.editor.AbstractPropertyEditor
clone, copyFrom, focusGained, focusLost, forwardKeyEvent, getComponent, getObject, getOwner, getParameterParser, getParams, getPropertyBrowser, getPropertyComponent, getPropertyName, getSafeString, getValidator, getValue, initialize, initializeComponent, isReadonly, keyReleased, keyTyped, loadProperty, parseParams, propertyChanged, resetComponentDisplay, resetProperty, saveProperty, setObject, setOwner, setParams, setPropertyBrowser, setPropertyName, setReadonly, setValidator, setValue, validateProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textField

protected javax.swing.JTextField textField
Text field as property editor component. (same as AbstractPropertyEditor.component, used to prevent casts)

Constructor Detail

StringEditor

public StringEditor()
Default constructor.

Method Detail

createComponent

public void createComponent()
Creates the editor component of the property editor.

Specified by:
createComponent in class AbstractPropertyEditor

setComponentValue

public void setComponentValue()
Sets the display component value.

Specified by:
setComponentValue in class AbstractPropertyEditor

getComponentValue

public java.lang.Object getComponentValue()
Gets the current editor component value.

Specified by:
getComponentValue in class AbstractPropertyEditor
Returns:
The current value of the component (can be null)
Note that this value might be different from the actual property value if the property hasn't been saved yet.

highlight

public void highlight(boolean on)
Highlights the content of the component.

Overrides:
highlight in class AbstractPropertyEditor
Parameters:
on - true Turns the highlight on if the component has the focus
false Turns the highlight off

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Gives notification that there was an insert into the document. The range given by the DocumentEvent bounds the freshly inserted region.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
Parameters:
e - Document event

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Gives notification that a portion of the document has been removed. The range is given in terms of what the view last saw (that is, before updating sticky positions).

Specified by:
removeUpdate in interface javax.swing.event.DocumentListener
Parameters:
e - Document event

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Gives notification that an attribute or set of attributes changed.

Specified by:
changedUpdate in interface javax.swing.event.DocumentListener
Parameters:
e - Document event

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Invoked when a key has been pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class AbstractPropertyEditor


Copyright © 2011. All Rights Reserved.