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.model;
020    
021    import java.io.Serializable;
022    
023    /**
024     * A model object used to represent the style for a line drawn.  See
025     * <a href='http://code.google.com/apis/chart/#line_styles'>Line styles</a>
026     * documentation for specifications.
027     *
028     * @author Rakesh 2008-08-10
029     * @version $Id: LineStyle.java 63 2008-08-29 07:46:39Z sptrakesh $
030     */
031    public class LineStyle implements Serializable
032    {
033      private static final long serialVersionUID = 1l;
034    
035      /** The thickness of the line to draw. */
036      public final int thickness;
037    
038      /** The length of a line segement to draw.  Specify 1 for solid lines. */
039      public final int segmentLength;
040    
041      /** The length of the blank segment.  Specify 0 for solid lines. */
042      public final int blankSegmentLength;
043    
044      /**
045       * Create a new instance using the specified values.  Use this constructor
046       * to create a solid line.
047       *
048       * @param thickness The {@link #thickness} value to set.
049       * @param optional Optionally specify {@link #segmentLength} and {@link
050       *   #blankSegmentLength} in sequence.
051       */
052      public LineStyle( final int thickness, int... optional )
053      {
054        this.thickness = thickness;
055        this.segmentLength = ( optional.length > 0 ) ? optional[0] : 1;
056        this.blankSegmentLength = ( optional.length > 1 ) ? optional[1] : 0;
057      }
058    }