001package kiwi.ui.propeditor;
002
003import java.awt.event.*;
004import javax.swing.*;
005
006import kiwi.ui.*;
007
008/**
009 * @author Mark Lindner
010 */
011
012public class TextValueEditor extends PropertyValueEditor
013  {
014  private DataField field;
015  
016  /**
017   */
018  
019  public TextValueEditor()
020    {
021    field = new DataField(15);
022    }
023  
024  /**
025   */
026  
027  protected void prepareEditor()
028    {
029    TextPropertyType type = (TextPropertyType)property.getType();
030    field.setMaximumLength(type.getMaximumLength());
031
032    field.setText((String)property.getValue());
033    }
034
035  public void commitInput()
036    {
037    property.setValue(field.getText());
038    }
039  
040  /**
041   */
042
043  public void addActionListener(ActionListener listener)
044    {
045    field.addActionListener(listener);
046    }
047
048  /**
049   */
050
051  public void removeActionListener(ActionListener listener)
052    {
053    field.removeActionListener(listener);
054    }
055  
056   /**
057    */
058   
059  public JComponent getEditorComponent()
060    {
061    return(field);
062    }
063
064  public void startFocus()
065    {
066    field.requestFocus();
067    }
068  
069  }
070
071/* end of source file */