Package weka.gui
Class GenericArrayEditor
- java.lang.Object
-
- weka.gui.GenericArrayEditor
-
- All Implemented Interfaces:
java.beans.PropertyEditor
public class GenericArrayEditor extends java.lang.Object implements java.beans.PropertyEditorA PropertyEditor for arrays of objects that themselves have property editors.- Version:
- $Revision: 14497 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
-
-
Constructor Summary
Constructors Constructor Description GenericArrayEditor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)Adds a PropertyChangeListener who will be notified of value changes.java.lang.StringgetAsText()Returns null as we don't support getting/setting values as text.java.awt.ComponentgetCustomEditor()Returns the array editing component.java.lang.StringgetJavaInitializationString()Supposedly returns an initialization string to create a classifier identical to the current one, including it's state, but this doesn't appear possible given that the initialization string isn't supposed to contain multiple statements.java.lang.String[]getTags()Returns null as we don't support getting values as tags.java.lang.ObjectgetValue()Gets the current object array.booleanisPaintable()Returns true to indicate that we can paint a representation of the string array.static voidmain(java.lang.String[] args)Tests out the array editor from the command line.static java.lang.ObjectmakeCopy(java.lang.Object source)Makes a copy of an object using serialization.voidpaintValue(java.awt.Graphics gfx, java.awt.Rectangle box)Paints a representation of the current classifier.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)Removes a PropertyChangeListener.voidsetAsText(java.lang.String text)Returns null as we don't support getting/setting values as text.voidsetValue(java.lang.Object o)Sets the current object array.booleansupportsCustomEditor()Returns true because we do support a custom editor.
-
-
-
Method Detail
-
setValue
public void setValue(java.lang.Object o)
Sets the current object array.- Specified by:
setValuein interfacejava.beans.PropertyEditor- Parameters:
o- an object that must be an array.
-
getValue
public java.lang.Object getValue()
Gets the current object array.- Specified by:
getValuein interfacejava.beans.PropertyEditor- Returns:
- the current object array
-
getJavaInitializationString
public java.lang.String getJavaInitializationString()
Supposedly returns an initialization string to create a classifier identical to the current one, including it's state, but this doesn't appear possible given that the initialization string isn't supposed to contain multiple statements.- Specified by:
getJavaInitializationStringin interfacejava.beans.PropertyEditor- Returns:
- the java source code initialisation string
-
isPaintable
public boolean isPaintable()
Returns true to indicate that we can paint a representation of the string array.- Specified by:
isPaintablein interfacejava.beans.PropertyEditor- Returns:
- true
-
paintValue
public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)Paints a representation of the current classifier.- Specified by:
paintValuein interfacejava.beans.PropertyEditor- Parameters:
gfx- the graphics context to usebox- the area we are allowed to paint into
-
getAsText
public java.lang.String getAsText()
Returns null as we don't support getting/setting values as text.- Specified by:
getAsTextin interfacejava.beans.PropertyEditor- Returns:
- null
-
setAsText
public void setAsText(java.lang.String text)
Returns null as we don't support getting/setting values as text.- Specified by:
setAsTextin interfacejava.beans.PropertyEditor- Parameters:
text- the text value- Throws:
java.lang.IllegalArgumentException- as we don't support getting/setting values as text.
-
getTags
public java.lang.String[] getTags()
Returns null as we don't support getting values as tags.- Specified by:
getTagsin interfacejava.beans.PropertyEditor- Returns:
- null
-
supportsCustomEditor
public boolean supportsCustomEditor()
Returns true because we do support a custom editor.- Specified by:
supportsCustomEditorin interfacejava.beans.PropertyEditor- Returns:
- true
-
getCustomEditor
public java.awt.Component getCustomEditor()
Returns the array editing component.- Specified by:
getCustomEditorin interfacejava.beans.PropertyEditor- Returns:
- a value of type 'java.awt.Component'
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a PropertyChangeListener who will be notified of value changes.- Specified by:
addPropertyChangeListenerin interfacejava.beans.PropertyEditor- Parameters:
l- a value of type 'PropertyChangeListener'
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener.- Specified by:
removePropertyChangeListenerin interfacejava.beans.PropertyEditor- Parameters:
l- a value of type 'PropertyChangeListener'
-
makeCopy
public static java.lang.Object makeCopy(java.lang.Object source)
Makes a copy of an object using serialization.- Parameters:
source- the object to copy- Returns:
- a copy of the source object, null if copying fails
-
main
public static void main(java.lang.String[] args)
Tests out the array editor from the command line.- Parameters:
args- ignored
-
-