weka.gui
Class SimpleDateFormatEditor

java.lang.Object
  extended by weka.gui.SimpleDateFormatEditor
All Implemented Interfaces:
PropertyEditor

public class SimpleDateFormatEditor
extends Object
implements PropertyEditor

Class for editing SimpleDateFormat strings.

Version:
$Revision: 8034 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
SimpleDateFormat

Field Summary
static String DEFAULT_FORMAT
          the default format
 
Constructor Summary
SimpleDateFormatEditor()
          Constructs a new SimpleDateFormatEditor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds an object to the list of those that wish to be informed when the date format changes.
 String getAsText()
          Returns the date format string.
 Component getCustomEditor()
          Gets a GUI component with which the user can edit the date format.
 String getJavaInitializationString()
          Returns the Java code that generates an object the same as the one being edited.
 String[] getTags()
          Some objects can return tags, but a date format cannot.
 Object getValue()
          Gets the date format that is being edited.
 boolean isPaintable()
          Indicates whether the object can be represented graphically.
 void paintValue(Graphics gfx, Rectangle box)
          Paints a graphical representation of the object.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes an object from the list of those that wish to be informed when the date format changes.
 void setAsText(String text)
          Sets the date format string.
 void setValue(Object value)
          Sets the value of the date format to be edited.
 boolean supportsCustomEditor()
          Indicates whether the date format can be edited in a GUI, which it can.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

public static final String DEFAULT_FORMAT
the default format

See Also:
Constant Field Values
Constructor Detail

SimpleDateFormatEditor

public SimpleDateFormatEditor()
Constructs a new SimpleDateFormatEditor.

Method Detail

setValue

public void setValue(Object value)
Sets the value of the date format to be edited.

Specified by:
setValue in interface PropertyEditor
Parameters:
value - a SimpleDateFormat object to be edited

getValue

public Object getValue()
Gets the date format that is being edited.

Specified by:
getValue in interface PropertyEditor
Returns:
the edited SimpleDateFormat object

isPaintable

public boolean isPaintable()
Indicates whether the object can be represented graphically. In this case it can.

Specified by:
isPaintable in interface PropertyEditor
Returns:
true

paintValue

public void paintValue(Graphics gfx,
                       Rectangle box)
Paints a graphical representation of the object. It just prints the format.

Specified by:
paintValue in interface PropertyEditor
Parameters:
gfx - the graphics context to draw the representation to
box - the bounds within which the representation should fit.

getJavaInitializationString

public String getJavaInitializationString()
Returns the Java code that generates an object the same as the one being edited.

Specified by:
getJavaInitializationString in interface PropertyEditor
Returns:
the initialization string

getAsText

public String getAsText()
Returns the date format string.

Specified by:
getAsText in interface PropertyEditor
Returns:
the date format string

setAsText

public void setAsText(String text)
Sets the date format string.

Specified by:
setAsText in interface PropertyEditor
Parameters:
text - the date format string

getTags

public String[] getTags()
Some objects can return tags, but a date format cannot.

Specified by:
getTags in interface PropertyEditor
Returns:
null

getCustomEditor

public Component getCustomEditor()
Gets a GUI component with which the user can edit the date format.

Specified by:
getCustomEditor in interface PropertyEditor
Returns:
an editor GUI component

supportsCustomEditor

public boolean supportsCustomEditor()
Indicates whether the date format can be edited in a GUI, which it can.

Specified by:
supportsCustomEditor in interface PropertyEditor
Returns:
true

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds an object to the list of those that wish to be informed when the date format changes.

Specified by:
addPropertyChangeListener in interface PropertyEditor
Parameters:
listener - a new listener to add to the list

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes an object from the list of those that wish to be informed when the date format changes.

Specified by:
removePropertyChangeListener in interface PropertyEditor
Parameters:
listener - the listener to remove from the list


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.