001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.ui.components.gpropertyeditor.editors.inplace;
005    
006    import graphlab.platform.lang.ArrayX;
007    
008    import java.awt.*;
009    
010    /**
011     * @author Azin Azadi
012     */
013    public class ArrayXEditor extends GComboEditor {
014        ArrayX x;
015    
016        public ArrayXEditor(ArrayX x) {
017            this.x = x;
018        }
019    
020        public Component getEditorComponent(Object value) {
021            x = (ArrayX) value;
022            return super.getEditorComponent(value);
023        }
024    
025        public Object getSelectedItem() {
026            Object o = super.getSelectedItem();
027            x.setValue(o);
028            return x;
029        }
030    
031        public Object[] getValues() {
032            return x.getValidValues();
033        }
034    }