001package kiwi.ui.propeditor; 002 003import java.awt.event.*; 004import javax.swing.*; 005 006import kiwi.text.FormatConstants; 007import kiwi.ui.*; 008import kiwi.util.IntegerHolder; 009 010/** 011 * @author Mark Lindner 012 */ 013 014public class ListValueEditor extends PropertyValueEditor 015 { 016 private JComboBox list; 017 018 /** 019 */ 020 021 public ListValueEditor() 022 { 023 list = new JComboBox(); 024 } 025 026 /** 027 */ 028 029 protected void prepareEditor() 030 { 031 ListPropertyType type = (ListPropertyType)property.getType(); 032 033 list.removeAllItems(); 034 Object items[] = type.getItems(); 035 for(int i = 0; i < items.length; i++) 036 list.addItem(items[i]); 037 038 list.setSelectedItem(property.getValue()); 039 } 040 041 public void startFocus() 042 { 043 //list.showPopup(); 044 } 045 046 public void commitInput() 047 { 048 property.setValue(list.getSelectedItem()); 049 } 050 051 /** 052 */ 053 054 public void addActionListener(ActionListener listener) 055 { 056 list.addActionListener(listener); 057 } 058 059 /** 060 */ 061 062 public void removeActionListener(ActionListener listener) 063 { 064 list.removeActionListener(listener); 065 } 066 067 /** 068 */ 069 070 public JComponent getEditorComponent() 071 { 072 return(list); 073 } 074 075} 076 077/* end of source file */