vis.beans.editors
Class ArrayEditor

java.lang.Object
  |
  +--java.beans.PropertyEditorSupport
        |
        +--vis.beans.editors.ArrayEditor
All Implemented Interfaces:
java.beans.PropertyEditor

public class ArrayEditor
extends java.beans.PropertyEditorSupport

ArrayEditor Class

Version:
1.0 24 July 1997
Author:
Lawrence Rodrigues An indexed property editor class for Integer arrays.

Field Summary
protected  java.lang.Object oldVal
           
 
Constructor Summary
ArrayEditor()
           
 
Method Summary
protected  java.lang.Object convertInput(java.lang.String str)
          Converts the string to integer array.
static java.lang.String[] convertToString(java.lang.Object obj)
           
 java.lang.String getAsText()
           
static int getLength(java.lang.Object obj)
           
 java.lang.Object getValue()
           
 void setAsText(java.lang.String txt)
          This method is called by the builder tool whenever there is a change in the text in the edit field.
 void setValue(java.lang.Object val)
          This method is initially called by the builder tool.
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getTags, isPaintable, paintValue, removePropertyChangeListener, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oldVal

protected java.lang.Object oldVal
Constructor Detail

ArrayEditor

public ArrayEditor()
Method Detail

setValue

public void setValue(java.lang.Object val)
This method is initially called by the builder tool. It casts the input object into an integer array. It converts this array into a string an saves it in txtValue. It is essential that this conversion done here. This is because when the builder tool calls the setAsText method, txtValue will not be null.
Overrides:
setValue in class java.beans.PropertyEditorSupport
Parameters:
val - the value of the property.

getValue

public java.lang.Object getValue()
Overrides:
getValue in class java.beans.PropertyEditorSupport
Returns:
the actual integer array.

setAsText

public void setAsText(java.lang.String txt)
This method is called by the builder tool whenever there is a change in the text in the edit field. It converts the text value to an integer array. It fires the property change event only when the array length equals to the length of the property.
Overrides:
setAsText in class java.beans.PropertyEditorSupport

getAsText

public java.lang.String getAsText()
Overrides:
getAsText in class java.beans.PropertyEditorSupport
Returns:
txtValue the text value of the integer array

convertInput

protected java.lang.Object convertInput(java.lang.String str)
Converts the string to integer array.

getLength

public static int getLength(java.lang.Object obj)

convertToString

public static java.lang.String[] convertToString(java.lang.Object obj)