Package weka.gui
Class CostMatrixEditor
java.lang.Object
weka.gui.CostMatrixEditor
- All Implemented Interfaces:
PropertyEditor
Class for editing CostMatrix objects. Brings up a custom editing panel with
which the user can edit the matrix interactively, as well as save load cost
matrices from files.
- Version:
- $Revision: 15103 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an object to the list of those that wish to be informed when the cost matrix changes.Some objects can be represented as text, but a cost matrix cannot.Gets a GUI component with which the user can edit the cost matrix.Returns the Java code that generates an object the same as the one being edited.String[]getTags()Some objects can return tags, but a cost matrix cannot.getValue()Gets the cost matrix that is being edited.booleanIndicates whether the object can be represented graphically.voidpaintValue(Graphics gfx, Rectangle box) Paints a graphical representation of the object.voidRemoves an object from the list of those that wish to be informed when the cost matrix changes.voidSome objects can be represented as text, but a cost matrix cannot.voidSets the value of the CostMatrix to be edited.booleanIndicates whether the cost matrix can be edited in a GUI, which it can.
-
Constructor Details
-
CostMatrixEditor
public CostMatrixEditor()Constructs a new CostMatrixEditor.
-
-
Method Details
-
setValue
Sets the value of the CostMatrix to be edited.- Specified by:
setValuein interfacePropertyEditor- Parameters:
value- a CostMatrix object to be edited
-
getValue
Gets the cost matrix that is being edited.- Specified by:
getValuein interfacePropertyEditor- Returns:
- the edited CostMatrix object
-
isPaintable
public boolean isPaintable()Indicates whether the object can be represented graphically. In this case it can.- Specified by:
isPaintablein interfacePropertyEditor- Returns:
- true
-
paintValue
Paints a graphical representation of the object. For the cost matrix it prints out the text "X x X matrix", where X is the size of the matrix.- Specified by:
paintValuein interfacePropertyEditor- Parameters:
gfx- the graphics context to draw the representation tobox- the bounds within which the representation should fit.
-
getJavaInitializationString
Returns the Java code that generates an object the same as the one being edited. Unfortunately this can't be done in a single line of code, so the code returned will only build a default cost matrix of the same size.- Specified by:
getJavaInitializationStringin interfacePropertyEditor- Returns:
- the initialization string
-
getAsText
Some objects can be represented as text, but a cost matrix cannot.- Specified by:
getAsTextin interfacePropertyEditor- Returns:
- null
-
setAsText
Some objects can be represented as text, but a cost matrix cannot.- Specified by:
setAsTextin interfacePropertyEditor- Parameters:
text- ignored- Throws:
IllegalArgumentException- always throws an IllegalArgumentException
-
getTags
Some objects can return tags, but a cost matrix cannot.- Specified by:
getTagsin interfacePropertyEditor- Returns:
- null
-
getCustomEditor
Gets a GUI component with which the user can edit the cost matrix.- Specified by:
getCustomEditorin interfacePropertyEditor- Returns:
- an editor GUI component
-
supportsCustomEditor
public boolean supportsCustomEditor()Indicates whether the cost matrix can be edited in a GUI, which it can.- Specified by:
supportsCustomEditorin interfacePropertyEditor- Returns:
- true
-
addPropertyChangeListener
Adds an object to the list of those that wish to be informed when the cost matrix changes.- Specified by:
addPropertyChangeListenerin interfacePropertyEditor- Parameters:
listener- a new listener to add to the list
-
removePropertyChangeListener
Removes an object from the list of those that wish to be informed when the cost matrix changes.- Specified by:
removePropertyChangeListenerin interfacePropertyEditor- Parameters:
listener- the listener to remove from the list
-