001    /*
002     * This file is part of the Echo Point Project.  This project is a
003     * collection of Components that have extended the Echo Web Application
004     * Framework Version 3.
005     *
006     * Version: MPL 1.1
007     *
008     * The contents of this file are subject to the Mozilla Public License Version
009     * 1.1 (the "License"); you may not use this file except in compliance with
010     * the License. You may obtain a copy of the License at
011     * http://www.mozilla.org/MPL/
012     *
013     * Software distributed under the License is distributed on an "AS IS" basis,
014     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015     * for the specific language governing rights and limitations under the
016     * License.
017     */
018    
019    package echopoint.google.chart;
020    
021    import echopoint.google.chart.internal.AbstractChart;
022    
023    /**
024     * Component wrapper for a
025     * <a href='http://code.google.com/apis/chart/#qrcodes'>QR codes</a>
026     * provided by <a href='http://code.google.com/apis/chart/'>Google Chart
027     * API</a>.
028     *
029     * <p>The following code shows sample use of this component:</p>
030     * <pre>
031     *   import echopoint.google.chart.QRCode;
032     *
033     *     ...
034     *     QRCode chart = new QRCode();
035     *     chart.setText( text );
036     * </pre>
037     *
038     * @author Rakesh Vidyadharan 2008-08-28
039     * @version $Id: QRCode.java 66 2008-09-09 08:13:37Z sptrakesh $
040     */
041    public class QRCode extends AbstractChart<Integer>
042    {
043      private static final long serialVersionUID = 1l;
044    
045      /**
046       * The property used to specify the text that is to be encoded as a QR code.
047       */
048      public static final String PROPERTY_TEXT = "text";
049    
050      /**
051       * The property used to specify the output encoding for the QR code text.
052       * This is optional and may be styled.  Google defaults to UTF-8.
053       */
054      public static final String PROPERTY_ENCODING = "encoding";
055    
056      /**
057       * Return the {@link #PROPERTY_TEXT} property value.
058       *
059       * @return The text value to be encoded as a QR code.
060       */
061      public String getText()
062      {
063        return (String) get( PROPERTY_TEXT );
064      }
065    
066      /**
067       * Set the value of the {@link #PROPERTY_TEXT} property.
068       *
069       * @param text The value to set.
070       */
071      public void setText( final String text )
072      {
073        set( PROPERTY_TEXT, text );
074      }
075    
076      /**
077       * Return the {@link #PROPERTY_ENCODING} property value.
078       *
079       * @return The output encoding that is to be used.
080       */
081      public String getEncoding()
082      {
083        return (String) get( PROPERTY_ENCODING );
084      }
085    
086      /**
087       * Set the value of the {@link #PROPERTY_ENCODING} property.
088       *
089       * @param encoding The value to set.
090       */
091      public void setEncoding( final String encoding )
092      {
093        set( PROPERTY_ENCODING, encoding );
094      }
095    }