IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.gui
Class ConverterEditor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bycom.ibm.dse.gui.ConverterEditor
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, javax.swing.event.ListSelectionListener, java.awt.MenuContainer, java.beans.PropertyEditor, java.io.Serializable

public class ConverterEditor
extends java.awt.Panel
implements java.beans.PropertyEditor, javax.swing.event.ListSelectionListener

The ConverterEditor class provides an editor for the formatter property, which is defined in the SpTextField bean and SpTable. There are five formaters: Null, Numeric, Integer, Float and Date. We can add more formatters following these steps:

- Create a new formatter class extended from Converter class.
- Create a new formatter Panel class extended from FormatterPanel class.
- Add these classes in formatters.properties file.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Container
 
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
ConverterEditor()
          This constructor creates a ConverterEditor object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Register a listener for the PropertyChange event.
 java.lang.String getAsText()
           
 java.awt.Component getCustomEditor()
          A PropertyEditor may choose to make available a full custom Component that edits its property value.
 java.lang.String getJavaInitializationString()
          This method is intended for use when generating Java code to set the value of the property.
 java.lang.String[] getTags()
          If the property value must be one of a set of known tagged values, then this method should return an array of the tags.
 java.lang.Object getValue()
           
 boolean isPaintable()
           
static void main(java.lang.String[] args)
          main entrypoint - starts the part when it is run as an application.
 void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)
          Paints a representation of the value into a given area of screen real estate.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener for the PropertyChange event.
 void setAsText(java.lang.String text)
          Sets the property value by parsing a given String.
 void setValue(java.lang.Object val)
          Sets (or changes) the object that is to be edited.
 boolean supportsCustomEditor()
           
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Method to handle events for the ListSelectionListener interface.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConverterEditor

public ConverterEditor()
This constructor creates a ConverterEditor object.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Register a listener for the PropertyChange event. When a PropertyEditor changes its value it should fire a PropertyChange event on all registered PropertyChangeListeners, specifying the null value for the property name and itself as the source.

Specified by:
addPropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
listener - An object to be invoked when a PropertyChange event is fired.

getAsText

public java.lang.String getAsText()
Specified by:
getAsText in interface java.beans.PropertyEditor
Returns:
The property value as a human editable string.

Returns null if the value can't be expressed as an editable string.

If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().


getCustomEditor

public java.awt.Component getCustomEditor()
A PropertyEditor may choose to make available a full custom Component that edits its property value. It is the responsibility of the PropertyEditor to hook itself up to its editor Component itself and to report property value changes by firing a PropertyChange event.

The higher-level code that calls getCustomEditor may either embed the Component in some larger property sheet, or it may put it in its own individual dialog, or ...

Specified by:
getCustomEditor in interface java.beans.PropertyEditor
Returns:
A java.awt.Component that will allow a human to directly edit the current property value. May be null if this is not supported.

getJavaInitializationString

public java.lang.String getJavaInitializationString()
This method is intended for use when generating Java code to set the value of the property. It should return a fragment of Java code that can be used to initialize a variable with the current property value.

Example results are "2", "new Color(127,127,34)", "Color.orange", etc.

Specified by:
getJavaInitializationString in interface java.beans.PropertyEditor
Returns:
A fragment of Java code representing an initializer for the current value.

getTags

public java.lang.String[] getTags()
If the property value must be one of a set of known tagged values, then this method should return an array of the tags. This can be used to represent (for example) enum values. If a PropertyEditor supports tags, then it should support the use of setAsText with a tag value as a way of setting the value and the use of getAsText to identify the current value.

Specified by:
getTags in interface java.beans.PropertyEditor
Returns:
The tag values for this property. May be null if this property cannot be represented as a tagged value.

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface java.beans.PropertyEditor
Returns:
The value of the property. Builtin types such as "int" will be wrapped as the corresponding object type such as "java.lang.Integer".

isPaintable

public boolean isPaintable()
Specified by:
isPaintable in interface java.beans.PropertyEditor
Returns:
True if the class will honor the paintValue method.

main

public static void main(java.lang.String[] args)
main entrypoint - starts the part when it is run as an application. This method is used for internal testing purposes only.

Parameters:
args - java.lang.String[]

paintValue

public void paintValue(java.awt.Graphics gfx,
                       java.awt.Rectangle box)
Paints a representation of the value into a given area of screen real estate. Note that the propertyEditor is responsible for doing its own clipping so that it fits into the given rectangle.

If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.

The given Graphics object will have the default font, color, etc of the parent container. The PropertyEditor may change graphics attributes such as font and color and doesn't need to restore the old values.

Specified by:
paintValue in interface java.beans.PropertyEditor
Parameters:
gfx - Graphics object to paint into.
box - Rectangle within graphics object into which we should paint.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener for the PropertyChange event.

Specified by:
removePropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
listener - The PropertyChange listener to be removed.

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Sets the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.

Specified by:
setAsText in interface java.beans.PropertyEditor
Parameters:
text - The string to be parsed.
Throws:
java.lang.IllegalArgumentException

setValue

public void setValue(java.lang.Object val)
Sets (or changes) the object that is to be edited. Builtin types such as "int" must be wrapped as the corresponding object type such as "java.lang.Integer".

Specified by:
setValue in interface java.beans.PropertyEditor

supportsCustomEditor

public boolean supportsCustomEditor()
Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor
Returns:
True if the propertyEditor can provide a custom editor.

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Method to handle events for the ListSelectionListener interface.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
e - javax.swing.event.ListSelectionEvent

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005