weka.gui
Class CostMatrixEditor

java.lang.Object
  |
  +--weka.gui.CostMatrixEditor
All Implemented Interfaces:
java.beans.PropertyEditor

public class CostMatrixEditor
extends java.lang.Object
implements java.beans.PropertyEditor

A PropertyEditor for CostMatrices. Allows editing of individual elements of the cost matrix, as well as simple operations like loading, saving.

Author:
Len Trigg (len@intelligenesis.net)

Constructor Summary
CostMatrixEditor()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a PropertyChangeListener who will be notified of value changes.
 java.lang.String getAsText()
          Returns null as we don't support getting/setting values as text.
 java.awt.Component getCustomEditor()
          Returns the array editing component.
 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.
 java.lang.String[] getTags()
          Returns null as we don't support getting values as tags.
 java.lang.Object getValue()
          Gets the current object array.
 boolean isPaintable()
          Returns true to indicate that we can paint a representation of the string array
static void main(java.lang.String[] args)
          Tests out the array editor from the command line.
 void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)
          Paints a representation of the current classifier.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a PropertyChangeListener.
 void setAsText(java.lang.String text)
          Returns null as we don't support getting/setting values as text.
 void setValue(java.lang.Object o)
          Sets the current object array.
 boolean supportsCustomEditor()
          Returns true because we do support a custom editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CostMatrixEditor

public CostMatrixEditor()
Method Detail

setValue

public void setValue(java.lang.Object o)
Sets the current object array.
Specified by:
setValue in interface java.beans.PropertyEditor
Parameters:
o - an object that must be an array.

getValue

public java.lang.Object getValue()
Gets the current object array.
Specified by:
getValue in interface java.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:
getJavaInitializationString in interface java.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:
isPaintable in interface java.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:
paintValue in interface java.beans.PropertyEditor
Parameters:
gfx - the graphics context to use
box - 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:
getAsText in interface java.beans.PropertyEditor
Returns:
null

setAsText

public void setAsText(java.lang.String text)
               throws java.lang.IllegalArgumentException
Returns null as we don't support getting/setting values as text.
Specified by:
setAsText in interface java.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:
getTags in interface java.beans.PropertyEditor
Returns:
null

supportsCustomEditor

public boolean supportsCustomEditor()
Returns true because we do support a custom editor.
Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor
Returns:
true

getCustomEditor

public java.awt.Component getCustomEditor()
Returns the array editing component.
Specified by:
getCustomEditor in interface java.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:
addPropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
l - a value of type 'PropertyChangeListener'

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener.
Specified by:
removePropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
l - a value of type 'PropertyChangeListener'

main

public static void main(java.lang.String[] args)
Tests out the array editor from the command line.
Parameters:
args - ignored