Clover coverage report - AdWT - 1.0.0
Coverage timestamp: sam. déc. 27 2003 15:14:10 CET
file stats: LOC: 108   Methods: 6
NCLOC: 53   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
PropertiesEditor.java - 0% 0% 0%
coverage
 1   
 /*
 2   
  * EJTools, the Enterprise Java Tools
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at www.gnu.org.
 6   
  */
 7   
 package org.ejtools.adwt.editor;
 8   
 
 9   
 import java.awt.Component;
 10   
 import java.io.ByteArrayInputStream;
 11   
 import java.io.ByteArrayOutputStream;
 12   
 import java.io.IOException;
 13   
 import java.util.Properties;
 14   
 
 15   
 import javax.swing.JTextArea;
 16   
 
 17   
 /**
 18   
  * Description of the Class
 19   
  *
 20   
  * @author    Laurent Etiemble
 21   
  * @version   $Revision: 1.5 $
 22   
  * @todo      Javadoc to complete
 23   
  */
 24   
 public class PropertiesEditor extends GenericEditor
 25   
 {
 26   
    /** Constructor for the PropertiesEditor object */
 27  0
    public PropertiesEditor()
 28   
    {
 29  0
       this.value = new Properties();
 30   
    }
 31   
 
 32   
 
 33   
    /**
 34   
     * Getter for the asText attribute
 35   
     *
 36   
     * @return   The value of asText attribute
 37   
     */
 38  0
    public String getAsText()
 39   
    {
 40  0
       ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
 41  0
       try
 42   
       {
 43  0
          ((Properties) this.value).store(bytearrayoutputstream, "");
 44   
       }
 45   
       catch (IOException ioe)
 46   
       {
 47   
       }
 48  0
       return bytearrayoutputstream.toString();
 49   
    }
 50   
 
 51   
 
 52   
    /**
 53   
     * Getter for the customEditor attribute
 54   
     *
 55   
     * @return   The value of customEditor attribute
 56   
     */
 57  0
    public Component getCustomEditor()
 58   
    {
 59  0
       return new PropertiesView();
 60   
    }
 61   
 
 62   
 
 63   
    /**
 64   
     * Setter for the asText attribute
 65   
     *
 66   
     * @param s  The new value for asText attribute
 67   
     */
 68  0
    public void setAsText(String s)
 69   
    {
 70  0
       try
 71   
       {
 72  0
          ((Properties) this.value).load(new ByteArrayInputStream(s.getBytes()));
 73  0
          this.firePropertyChange();
 74   
       }
 75   
       catch (IOException ioe)
 76   
       {
 77   
       }
 78   
    }
 79   
 
 80   
 
 81   
    /**
 82   
     * Description of the Method
 83   
     *
 84   
     * @return   Description of the Returned Value
 85   
     */
 86  0
    public boolean supportsCustomEditor()
 87   
    {
 88  0
       return true;
 89   
    }
 90   
 
 91   
 
 92   
    /**
 93   
     * Description of the Class
 94   
     *
 95   
     * @author    letiembl
 96   
     * @version   $Revision: 1.5 $
 97   
     */
 98   
    protected class PropertiesView extends JTextArea
 99   
    {
 100   
       /** Constructor for the PropertiesView object */
 101  0
       public PropertiesView()
 102   
       {
 103  0
          super(10, 40);
 104  0
          this.setText(PropertiesEditor.this.getAsText());
 105   
       }
 106   
    }
 107   
 }
 108