Package simtools.ui

Examples of simtools.ui.UserProperties$Info


   * <br><b>Summary:</b><br>
   * initialise stuff such as, userproperties, language and the actions.
   */
  private void init(){
    // Read properties => this contain the user preference, including language setup
    userProperties=new UserProperties("jlogtool", true);
    userProperties.read();

    // language may be "fr", or "en_US", or whatever. If unsupported, it will default to best match
    String language = userProperties.getString("jlogtool.language","");

View Full Code Here


    mainBuiltin = (Syn3DPlugin)pluginManager.getPlugin(Xith3DSyn3DBuiltin.class);
   
    tm = ((SceneGraphModel)new SceneGraphModelXith3D());
   
    // Others builtins related to the Java 3D plugin
    UserProperties p=Run.getProperties();
    String plugins=p.getProperty("syn3d.plugins.xith3d");
   
   
    // TODO placer dans la classe m�re ?
    if(plugins!=null){
      StringTokenizer st=new StringTokenizer(plugins,",;");
View Full Code Here

    else zip = null;
   
    // Code common with Run class

    // Read properties => this contain the user preference, including language setup
    userProperties=new UserProperties("jsynoptic");
    userProperties.read();

    // language may be "fr", or "en_US", or whatever. If unsupported, it will default to best match
    String language = userProperties.getString("jsynoptic.language","");
    // Let command-line -D JVM define take precedence
View Full Code Here

    mainBuiltin = (Java3DSyn3DBuiltin)pluginManager.getPlugin(Java3DSyn3DBuiltin.class);
   
    tm = ((SceneGraphModel)new SceneGraphModelJava3D());
   
    // Others builtins related to the Java 3D plugin
    UserProperties p=Run.getProperties();
    String plugins=p.getProperty("syn3d.plugins.java3d");
   
    if(plugins!=null){
      StringTokenizer st=new StringTokenizer(plugins,",;");
      while(st.hasMoreTokens()){
        String pn=st.nextToken();
View Full Code Here

        super();
        isTimePlot =  false;
        defaultPrimaryXDataSource = null;

        // get properties from configuration file
        UserProperties prop = Run.getProperties();
        if (prop!=null){
            nbColumns = prop.getInt("jsynoptic.base.GridShapesTemplate.nbRows", DEFAULT_ROW_NUMBER);

           String defaultDSName =  prop.getString("jsynoptic.base.GridShapesTemplate.defaultPrimaryXDataSource", DataInfo.getId((defaultPrimaryXDataSource)));
           if (defaultDSName != null){
               try{
                   defaultPrimaryXDataSource = DataSourcePool.global.getDataSourceWithId(defaultDSName);
               }catch (DuplicateIdException e){
               }
View Full Code Here

                defaultPrimaryXDataSource = null;
            }
           
           
            // save values
            UserProperties prop = Run.getProperties();
            if (prop!=null){
                prop.setBoolean("jsynoptic.base.GridShapesTemplate.isTimePlot", isTimePlot);
                if (defaultPrimaryXDataSource != null){
                    prop.setString("jsynoptic.base.GridShapesTemplate.defaultPrimaryXDataSource", DataInfo.getId((defaultPrimaryXDataSource)));
                }

            }
        }
View Full Code Here

public class UserPropertiesTest extends TestCase {
    /**
     * Test method for {@link simtools.ui.UserProperties#getProperty(java.lang.String)}.
     */
    public final void testGetPropertyString() {
        UserProperties childUp = new UserProperties(new File(UserPropertiesTest.class.getResource("property.txt").getPath()));
        childUp.read();
        //Test some properties
        String expected = "0";
        assertEquals(expected, childUp.getProperty("child.property0"));
        expected = "1";
        assertEquals(expected, childUp.getProperty("child.property1"));
        //retrieve master properties from child.
        expected = "0";
        assertEquals(expected, childUp.getProperty("master.property0"));
        //retrieve overriden property.
        expected = "2";
        assertEquals(expected, childUp.getProperty("master.property1"));
    }
View Full Code Here

    /**
     * Test method for {@link simtools.ui.UserProperties#setProperty(java.lang.String, java.lang.String)}.
     */
    public final void testSetPropertyStringString() {
        UserProperties childUp = new UserProperties(new File(UserPropertiesTest.class.getResource("property.txt").getPath()));
        childUp.read();
        //Set a child property.
        String expected = "0";
        //The set property must return old value, which should be 1.
        assertEquals(expected, childUp.setProperty("child.property0", "1"));
        //And then the property should be 1
        expected = "1";
        assertEquals(expected, childUp.getProperty("child.property0"));
        //Set a master property with the same value.
        expected = "0";
        assertEquals(expected, childUp.setProperty("master.property0", "0"));
        assertEquals(expected, childUp.getProperty("master.property0"));
        //Now check that this property has been saved in the child file, as it was the same value as the master.
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            childUp.store(out, "");
            String savedProperties = out.toString();
            //We have to check that master properties has not been saved.
            assertTrue(savedProperties.indexOf("master.property0") == -1);
        } catch (IOException e) {
            fail("IOException :"+e);
        }
        //Set a master property with a overriden value.
        expected = null;
        //expected value is the previous value, and as child file did have this property set, expected should be null.
        assertEquals(expected, childUp.setProperty("master.property0", "3"));
        //Now expected value is the newly set one.
        expected = "3";
        assertEquals(expected, childUp.getProperty("master.property0"));
        //Now check that this property has been saved in the child file, as it was the same value as the master.
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            childUp.store(out, "");
            String savedProperties = out.toString();
            //We have to check that master properties has been saved in child file.
            assertTrue(savedProperties.indexOf("master.property0") != -1);
        } catch (IOException e) {
            fail("IOException :"+e);
        }

        //Now try to set a new property.
        expected = "4";
        //The set property must return old value, which should null (new property).
        assertEquals(null, childUp.setProperty("child.property4", "4"));
        assertEquals(expected, childUp.getProperty("child.property4"));
    }
View Full Code Here

  /**
   * For testing purpose
   * @param args
   */
  public static void main(String[] args){
    final UserProperties userProperties=new UserProperties("splitTab");
    userProperties.read();

   
    javax.swing.JFrame f=new javax.swing.JFrame(SplitTabPane.class.getName());
   
    SplitTabPaneTest sts=new SplitTabPaneTest(f,JSplitPane.HORIZONTAL_SPLIT);
   
    addElement(sts, "one", TAB);

    f.getContentPane().add(sts,BorderLayout.SOUTH);
    System.out.println("SOUTH=====================");
    sts.print();

    SplitTabPaneTest stn=new SplitTabPaneTest(f,JSplitPane.HORIZONTAL_SPLIT);
   
    addElement(stn, "one", SPLIT);
    addElement(stn, "two", TAB);
    addElement(stn, "three", SPLIT);

    f.getContentPane().add(stn,BorderLayout.NORTH);
    System.out.println("NORTH=====================");
    stn.print();

    SplitTabPaneTest ste=new SplitTabPaneTest(f,JSplitPane.VERTICAL_SPLIT);
   
    addElement(ste, "one", TAB);
    addElement(ste, "two", TAB);

    f.getContentPane().add(ste,BorderLayout.EAST);
    System.out.println("EAST=====================");
    ste.print();

    SplitTabPaneTest stw=new SplitTabPaneTest(f,JSplitPane.VERTICAL_SPLIT);
   
    addElement(stw, "one", SPLIT);
    addElement(stw, "two", SPLIT);
    addElement(stw, "three", SPLIT);

    f.getContentPane().add(stw,BorderLayout.WEST);
    System.out.println("WEST=====================");
    stw.print();

    final SplitTabPaneTest stc=new SplitTabPaneTest(f,JSplitPane.VERTICAL_SPLIT);
   
    addElement(stc, "one", SPLIT);
    addElement(stc, "two", TAB);
    addElement(stc, "three", TAB);
    addElement(stc, "four", SPLIT);

    f.getContentPane().add(stc,BorderLayout.CENTER);
    System.out.println("CENTER=====================");
    stc.print();

    f.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
    f.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e) {
        stc.save(userProperties,"center");
        userProperties.write();
        System.exit(0);
      }
     
    });
    f.pack();
View Full Code Here

        nbColumns = DEFAULT_COLUMN_NUMBER;
        rowMargin = DEFAULT_ROW_MARGIN;
        colMargin = DEFAULT_COLUMN_MARGIN;
       
        // get properties from configuration file
        UserProperties prop = Run.getProperties();
        if (prop!=null){
            nbRows = prop.getInt("jsynoptic.base.GridShapesTemplate.nbRows", DEFAULT_ROW_NUMBER);
            nbColumns = prop.getInt("jsynoptic.base.GridShapesTemplate.nbColumns", DEFAULT_COLUMN_NUMBER);
        }
      
        gridShapePanel = new GridShapesTemplatePanel();
    }
View Full Code Here

TOP

Related Classes of simtools.ui.UserProperties$Info

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.