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.attrx;
005    
006    import graphlab.platform.attribute.AttributeListener;
007    import graphlab.platform.lang.ArrayX;
008    import graphlab.platform.lang.BoundedInteger;
009    import graphlab.ui.AttributeSetView;
010    import graphlab.ui.PortableNotifiableAttributeSetImpl;
011    import graphlab.ui.components.utils.GAttrFrame;
012    
013    import java.awt.*;
014    import java.io.File;
015    import java.util.Vector;
016    
017    /**
018     * documented in GraphLab wiki: HowToUsePropertyEditor
019     * @author Azin Azadi
020     */
021    public class tester {
022        public static void main(String[] args) {
023            PortableNotifiableAttributeSetImpl x = new PortableNotifiableAttributeSetImpl();
024            x.addAttributeListener(new AttributeListener() {
025                public void attributeUpdated(String name, Object oldVal, Object newVal) {
026                    System.out.println(name + ":" + newVal);
027                }
028            });
029            x.put("azin", "azadi");
030            x.put("file", new File("c:\\a.txt"));
031            Vector a = new Vector();
032            a.add("azin");
033            a.add(Color.red);
034            a.add(new BoundedInteger(10, 100, 0));
035            x.put("iterable", a);
036    
037            AttributeSetView atr = x.getView();
038    //        atr.get()
039            atr.setEditable("azin", false);
040            atr.setDisplayName("azin", "azin->disp name");
041            atr.setDescription("azin", "azin>desc");
042    
043    
044            x.put("xaray", new ArrayX("azin", "azin", "azadi", "yazdi", "graph"));
045    //        x.put("---", new ArrayX(true, false, "azin", Color.red));
046            x.put("bi", new BoundedInteger(20, 30, 10));
047    
048            GAttrFrame.showEditDialog(x);
049    
050            //Thread.getDefaultUncaughtExceptionHandler()
051            //ClassLoader.getSystemClassLoader().
052            //java.lang.Compiler.compileClass()
053        }
054    }